Skip to content

[FEATURE] Synchronous getCloudflareContext() #137

@james-elicx

Description

@james-elicx

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)

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions