Skip to content

Commit 0749e8c

Browse files
Refactor getCloudflareContext calls to use async option
1 parent aec51a2 commit 0749e8c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/content/docs/developer-spotlight/tutorials/fullstack-authentication-with-next-js-and-cloudflare-d1.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -212,11 +212,11 @@ const authResult = async (): Promise<NextAuthResult> => {
212212
return NextAuth({
213213
providers: [
214214
Resend({
215-
apiKey: (await getCloudflareContext()).env.AUTH_RESEND_KEY,
216-
from: (await getCloudflareContext()).env.AUTH_EMAIL_FROM,
215+
apiKey: (await getCloudflareContext({async: true})).env.AUTH_RESEND_KEY,
216+
from: (await getCloudflareContext({async: true})).env.AUTH_EMAIL_FROM,
217217
}),
218218
],
219-
adapter: D1Adapter((await getCloudflareContext()).env.DB),
219+
adapter: D1Adapter((await getCloudflareContext({async: true})).env.DB),
220220
});
221221
};
222222

@@ -255,7 +255,7 @@ import { getCloudflareContext } from "@opennextjs/cloudflare";
255255

256256
export async function GET() {
257257
try {
258-
await up((await getCloudflareContext()).env.DB)
258+
await up((await getCloudflareContext({async: true})).env.DB)
259259
} catch (e: unknown) {
260260
if (e instanceof Error) {
261261
const causeMessage = e.cause instanceof Error ? e.cause.message : String(e.cause);
@@ -328,7 +328,7 @@ async function updateName(formData: FormData): Promise<void> {
328328
return;
329329
}
330330
const query = `UPDATE users SET name = $1 WHERE id = $2`;
331-
await updateRecord((await getCloudflareContext()).env.DB, query, [name, session.user.id]);
331+
await updateRecord((await getCloudflareContext({async: true})).env.DB, query, [name, session.user.id]);
332332
redirect('/');
333333
}
334334

0 commit comments

Comments
 (0)