stytch-node
stytch-node copied to clipboard
How to disable `cache: "no-store"` after 9.0.5 update
Hi,
In Cloudflare Workers I'm receiving the error: The 'cache' field on 'RequestInitializerDict' is not implemented.
This is due to the latest 9.0.5
update. 9.0.4
works fine.
Is there a way to remove this for 9.0.5
and any future updates?
Thanks, Tom.
Hey @tdwells90 for immediate resolution can you try using the workaround described in https://github.com/stytchauth/stytch-node/issues/262#issuecomment-1764910451 to manually edit the fetchConfig
?
something like
function monkeyPatchStytchClientSettings(client: ...) {
/* eslint-disable */
const cl = <any>client;
/* eslint-enable */
cl.fetchConfig.cache = undefined;
}
should hopefully do the trick since the explicit undefined
should override the key.
> { foo: 1, ...{foo: undefined}}
{ foo: undefined }
We'll see if we can detect the CF worker runtime and avoid setting that key as an immediate fix.
Would also be great for us to add automated tests that deploy to Cloudflare and verify that we don't break things. Right now that process is manual and we're not running it on every commit.
@tdwells90 is this solution- https://github.com/cloudflare/workerd/issues/698#issuecomment-1737605504 - a viable workaround? It looks like cloudflare themselves plan on fixing this issue in some near future 🤞
Going into /node_modules/stytch/dist/shared/index.js
and commenting out the line that says cache: "no-store"
(currently line 19) worked for me
any updates on this?