Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions pages/cloudflare/bindings.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,17 @@ export async function GET(request) {
}
```

<Callout type='info'>
`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`:
```js
const context = await getCloudflareContext({ async: true });
```

**WARNING**: During SSG caution is advised since secrets (stored in `.dev.vars` files) and local development
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

We should really have an HowTo to explain the setup...

values from bindings (like values saved in a local KV) will be used for the pages static generation.

</Callout>

#### How to add bindings to your Worker

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