Skip to content

🐛 BUG: checkedFetch does not support global fetch function which is Proxied #3478

@evanderkoogh

Description

@evanderkoogh

Which Cloudflare product(s) does this pertain to?

Wrangler

What version of Wrangler are you using?

3.1.0

What operating system are you using?

Mac

Describe the Bug

I am working on an open telemetry library, which needs to proxy the fetch function to intercept the request/response and modify the request out. This works great in production, but when wrangler is in development mode, wrangler substitutes references to the global fetch function with the checkedFetch function with the esbuild define functionality.

This seems to lead to situations where checkedFetch and the proxied fetch keep calling each other.

Would there be any objections to changing the checkedFetch functionality from a substitution to JS Proxy as well? That should work much more reliably. Happy to submit a PR for that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething that isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions