Closed anku255 closed 1 month ago
Not sure if it's because of recent changes in Cloudflare runtime or not, but the error returned since couple of days ago:
Error: The 'cache' field on 'RequestInitializerDict' is not implemented.
It seems that the error is not thrown where Supertoken catches as I debugged and it could never reach catch
block. I tried the following and it works:
const fetchFunction = typeof fetch !== "undefined" ? fetch : crossFetch;
try {
delete init.cache;
return fetchFunction(input, init);
} catch (e) {
// it could never reach here
}
@rishabhpoddar @anku255 Would it make sense to have a setting flag to enable/disable adding cache
to init
object behavior, so users have control over which behavior to use?
@ngoquoc I am not able to reproduce this. Can you share your supertokens-node
and wrangler
version?
We also have a cf-example app. You can try that and see if you are able to reproduce this issue there.
@anku255
I'm using "supertokens-node": "^18.0.0"
and "wrangler": "^3.60.3"
.
I also deployed the example app (respecting the versions in package-lock) and could reproduce the same error. Please see the full error log: cf-init-cache-error-log.json
Thank you @ngoquoc
It seems that error is producible after deployment but not locally using the Wrangler CLI. I will be taking a look soon. Will keep you updated on the same thread.
@ngoquoc We have released a fix in v18.0.1. You can try that and let us know.
@anku255 thank you very much. Tried 18.0.1 and it works perfectly.
Summary of change
Add workaround for unsupported 'cache' field in Cloudflare Workers
If a fetch request fails due to the 'cache' field not being implemented in Cloudflare Workers, retry the request without the 'cache' field. More info: https://github.com/cloudflare/workerd/issues/698
Test Plan
(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work. Bonus points for screenshots and videos!)
Documentation changes
(If relevant, please create a PR in our docs repo, or create a checklist here highlighting the necessary changes)
Checklist for important updates
coreDriverInterfaceSupported.json
file has been updated (if needed)lib/ts/version.ts
frontendDriverInterfaceSupported.json
file has been updated (if needed)package.json
package-lock.json
lib/ts/version.ts
npm run build-pretty
recipe/thirdparty/providers/configUtils.ts
file,createProvider
function.git tag
) in the formatvX.Y.Z
, and then find the latest branch (git branch --all
) whoseX.Y
is greater than the latest released tag.add-ts-no-check.js
file to include thatsomeFunc: function () {..}
).