Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5284312

Browse files
add callout about getCloudflareContext in "async mode" (#75)
1 parent 75c3b3c commit 5284312

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

pages/cloudflare/bindings.mdx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,17 @@ export async function GET(request) {
2727
}
2828
```
2929

30+
<Callout type='info'>
31+
`getCloudflareContext` can only be used in SSG routes in "async mode" (making it return a promise), to run the function in such a way simply provide an options argument with `async` set to `true`:
32+
```js
33+
const context = await getCloudflareContext({ async: true });
34+
```
35+
36+
**WARNING**: During SSG caution is advised since secrets (stored in `.dev.vars` files) and local development
37+
values from bindings (like values saved in a local KV) will be used for the pages static generation.
38+
39+
</Callout>
40+
3041
#### How to add bindings to your Worker
3142

3243
Add bindings to your Worker by adding them to your [wrangler configuration file](https://developers.cloudflare.com/workers/wrangler/configuration/).

0 commit comments

Comments
 (0)