-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Add environment to Cloudflare adapter #2844
Comments
Related to #2807 |
Not being able to access Cloudflare KV makes implementing sessions way too hard :-( |
I had to fork existing adapter and pass env to request object. It is a pity that this adapter even exists(it is pre-alpha IMHO). Without providing access to ENV & Durable Objects, using workers is almost pointless. |
We need this, I hope it will be fixed soon. |
This no longer works since the commit that added a check for the keys being passed in from the adapter: kit/packages/kit/src/core/build/build_server.js Lines 91 to 94 in f89fb52
As a workaround I'm adding In the forked adapter:
I imagine passing extra keys on the request object would begin working again once that TODO to remove the check is resolved. Not sure if passing extra properties to the request object is going to be a reliable way of passing platform features along to hooks.js and endpoints, guessing it's not specifically part of the app.render api contract? Edit: Changed to passing env via symbol property so it doesn't appear in |
This should be implemented now |
Describe the problem
Cloudflare Workers provide an environment object containing environment variables and bindings to other Cloudflare services, such as Workers KV and Durable Objects. Currently, the Cloudflare adapter doesn't seem pass this object to endpoints, so those endpoints can't access those services.
Describe the proposed solution
The Cloudflare adapter should pass the environment object through to the endpoint somehow, potentially through the request's locals. In addition, it would be great to have a way to export Durable Object classes.
Alternatives considered
No response
Importance
would make my life easier
Additional Information
No response
The text was updated successfully, but these errors were encountered: