Skip to content

Cloudflare Binding Support #11787

Closed
Closed
@helloimalastair

Description

@helloimalastair

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions