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

Cloudflare Binding Support #11787

Closed
helloimalastair opened this issue Feb 2, 2024 · 2 comments
Closed

Cloudflare Binding Support #11787

helloimalastair opened this issue Feb 2, 2024 · 2 comments

Comments

@helloimalastair
Copy link

helloimalastair commented Feb 2, 2024

Describe the problem

At the moment, SvelteKit does not appear to support using actual bindings when using adapter-cloudflare(not sure about adapter-cloudflare-workers). This resulted in projects like cf-bindings-proxy, which give you a function that, when platform.env is not detected, will fetch a separate Worker that served as a proxy for the requested bindings.

Describe the proposed solution

Miniflare recently re-added support for get*() methods, which allows you to get bindings directly. This can then be used in conjunction with adapter.emulate() to pass bindings, cache, req.cf info, and the ctx object, allowing SvelteKit local dev to come closer to how it functions when deployed.

Alternatives considered

This could also be remedied by running the entire SvelteKit dev server within workerd/wrangler, but support for that from both the Cloudflare and SvelteKit team seems a way off.

Importance

would make my life easier

Additional Information

Accidentally made #11786 after pushing to my fork, I'll leave it up as an example/able to push it if y'all think it is a good idea.

@izznatsir
Copy link

izznatsir commented Feb 2, 2024

Seems #11732 is already implementing this via getBindingsProxy function from Wrangler.

@helloimalastair
Copy link
Author

Sounds good. Closing this and my PR

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

No branches or pull requests

2 participants