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

The credentials field on RequestInitializerDict is not implemented; Cloudflare Workers issue. #366

Closed
TimTinkers opened this issue Aug 6, 2021 · 5 comments · Fixed by #559

Comments

@TimTinkers
Copy link

I am experiencing the same issue with credentials that prevents ky from being used with Cloudflare Workers that redaxios is also experiencing here.

@TimTinkers
Copy link
Author

Never mind, it could be that I am just supposed to manually override the credentials in such case as was previously discovered on the Cloudflare Workers Discord server.

meme

@sholladay
Copy link
Collaborator

I suppose we could internally feature test the field. Not ideal, though. Did setting it to undefined work for you?

@aroman
Copy link

aroman commented Jun 12, 2023

any progress on this? ky works fine in cloudflare workers environment, but this type error makes it so i need to use skipLibCheck in my tsconfig.

as additional context, Cloudflare has officially stated that Cloudflare Workers do not support the credentials property. Seems a shame to "throw the baby out with the bath water" just for that one property.

@sholladay
Copy link
Collaborator

The fix for this is likely trivial once someone who uses Workers steps in to help.

We need to guard this line to avoid setting credentials if it is unsupported.

My first guess about how to do so is:

const isCredentialsSupported = 'credentials' in Request.prototype;

That resolves to true in browsers. Hopefully it resolves to false in Workers. Could someone who uses Workers please confirm?

@zanechua
Copy link

@sholladay it does resolve to false indeed.

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.

4 participants