Skip to content
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

[FEATURE] Synchronous getCloudflareContext() #137

Open
2 tasks done
james-elicx opened this issue Nov 18, 2024 · 1 comment
Open
2 tasks done

[FEATURE] Synchronous getCloudflareContext() #137

james-elicx opened this issue Nov 18, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@james-elicx
Copy link
Collaborator

Is your feature request related to a problem?

The getCloudflareContext() utility cannot be used in certain places as it is async function, and therefore requires awaiting. Class constructors and global variables often depend on the expectation of being synchronous, and therefore are prevented from leveraging the utility for bindings, and have to use process.env instead.

Describe the solution you'd like

getCloudflareContext() should be able to be used synchronously.

Describe alternatives you've considered

N/A.

@opennextjs/cloudflare version

0.2.1

Additional context

The next-on-pages approach to this problem involved a way to setup the environment in the Next.js config file, and then interacting with a global symbol on process.env in dev mode.

https://github.com/cloudflare/next-on-pages/tree/main/internal-packages/next-dev

Before submitting

  • I have checked that there isn't already a similar feature request
  • This is a single feature (not multiple features in one request)
@vicb
Copy link
Contributor

vicb commented Nov 19, 2024

context: #136 (comment)
there we might be able to use the async API

@vicb vicb removed the triage label Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants