Skip to content

Conversation

dario-piotrowicz
Copy link
Contributor

currently getCloudflareContext run in sync mode at the top level of a not static route
gives a misleading error message saying that the function needs to be run in a not static
route, the changes here correct this error message clarifying that the problem actually is

fixes #382

@changeset-bot
Copy link

changeset-bot bot commented Feb 21, 2025

🦋 Changeset detected

Latest commit: d515326

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@opennextjs/cloudflare Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 21, 2025

Open in Stackblitz

pnpm add https://pkg.pr.new/@opennextjs/cloudflare@404

commit: d515326

@dario-piotrowicz
Copy link
Contributor Author

PS: as mentioned in this comment: #382 (comment), unfortunately I think that updating the error message to be more generic is the best we can do here 😓 (since we can't make the sync version of getCloudflareContext work at the top level and we can't detect whether a route is being server side rendered or not)

@dario-piotrowicz dario-piotrowicz merged commit 12d385d into main Feb 24, 2025
7 checks passed
@dario-piotrowicz dario-piotrowicz deleted the dario/382/getCloudflareContext-async-error branch February 24, 2025 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] can getCloudflareContext({async: false}) work at top level with next dev

2 participants