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 Workers Error: Error: The 'cache' field on 'RequestInitializerDict' is not implemented. #242

Open
harrismcc opened this issue Nov 22, 2024 · 5 comments · May be fixed by #243
Open

Comments

@harrismcc
Copy link

When running in a cloudflare worker, I'm getting the following error when attempting to call axiom.flush(): Error: The 'cache' field on 'RequestInitializerDict' is not implemented.

Looking at the stack trace is pointing me to this line:

cache: 'no-cache',

Cloudflare recently had a compatibility flag become default involving this https://developers.cloudflare.com/workers/configuration/compatibility-flags/#enable-cache-no-store-http-standard-api so maybe something broke?

Is there something actually broken here, or is this some kind of misconfiguration on my end? Thanks!

@harrismcc
Copy link
Author

With a bit of testing and some node_modules surgery, I can confirm that when either commenting out that line, or changing it to no-store it works again.

It seems like this might be an upstream cloudflare issue cloudflare/workerd#698

But maybe adding an option where the cache could be toggled off would fix this, at least until cloudflare fixes the root issue?

@harrismcc harrismcc linked a pull request Nov 22, 2024 that will close this issue
@harrismcc
Copy link
Author

harrismcc commented Nov 22, 2024

Just heard from the Cloudflare folks and it seems like support for no-cache is in the works, but not compatible yet. no-store however works, so another fix (that wouldn't require a new config option) would be to swap out no-cache for no-store

cloudflare/workerd#698 (comment)

@harrismcc
Copy link
Author

just bumping this, cloudflare team is still working on the compatibility fix so this functionality is still broken at the moment

@dasfmi
Copy link
Collaborator

dasfmi commented Dec 13, 2024

hi @harrismcc, apologies for my late reply. I will prepare a PR with no-store until Cloudflare support no-cache then we can perhaps switch back.

@dasfmi
Copy link
Collaborator

dasfmi commented Dec 13, 2024

@harrismcc just noticed you already have a PR, would you like to update it to no-store? or better, the config option could be a value for the cache option with no-cache being default. A section in README could point Cloudflare users to override the config with no-store and link the Cloudflare issue.

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

Successfully merging a pull request may close this issue.

2 participants