-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
D1 configuration page includes non-working examples #12044
Comments
Should use the convention of your framework. eg |
It's not |
export const onRequest = async (context) => {
const { request, env } = context;
return NextAuth({
providers: [],
adapter: D1Adapter(env.db),
})(request);
}; You may try using the above snippet once & let me know if it works. |
I am stuck on this as well. I thought I almost had it working with the below code as it does give me access to the D1 instances but getting the error "vite_ssr_import_0.default is not a function" src/middleware/index.ts
|
I managed to get the D1 adapter working on a next app and opened a PR to update the documentation #12164 |
What is the improvement or update you wish to see?
I would like information on how to initialize Auth.js using D1 that helps me deal with the fact that I can't get access to any of the environment bindings outside of a request.
The example given doesn't compile or work.
Is there any context that might help us understand?
The setup procedure for the D1 Adpater on https://authjs.dev/getting-started/adapters/d1#configuration includes code examples that don't work. In the example below
env
is undefined.None of the packages for running Next.js on Cloudflare, neither workers nor pages, provide access to the Cloudflare Env and bindings ourside the context of a request.
Does the docs page already exist? Please link to it.
https://authjs.dev/getting-started/adapters/d1#configuration
The text was updated successfully, but these errors were encountered: