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

Skip to content

fix incorrect (sync) getCloudflareContext error message #404

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

Merged
merged 1 commit into from
Feb 24, 2025

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

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

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