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

Getting 500 trying to run Sanity + Nuxt 3 on Cloudflare Workers #660

Closed
VicFleur opened this issue Feb 1, 2023 · 5 comments
Closed

Getting 500 trying to run Sanity + Nuxt 3 on Cloudflare Workers #660

VicFleur opened this issue Feb 1, 2023 · 5 comments
Labels
bug Something isn't working upstream

Comments

@VicFleur
Copy link

VicFleur commented Feb 1, 2023

Version

module: 1.6.0
nuxt: 3.1.1

Nuxt configuration

Super simple setup

sanity: {
    projectId: '########',
    minimal: true
}

using minimal or not doesn't have any effect, using useSanityQuery or sanity.fetch does not matter either

Reproduction

Just create a barebones Nuxt 3 app, install Sanity and run a simple groq query through useSanityQuery

What is expected?

getting Sanity's content on the server side

What is actually happening?

it works only on the client side, while every time a query is fired from SSR it returns a 500 error with the following message:
The 'credentials' field on 'RequestInitializerDict' is not implemented.

I am aware that this might be mainly due to a feature not supported by Cloudflare as noted in this thread. However, other libraries with a similar problem seem to have some sorts of way to bypass the thing if I'm not misinterpreting these answers.

So I was wondering if Sanity's module has a way around this missing bit or not.

@VicFleur VicFleur added the bug Something isn't working label Feb 1, 2023
@danielroe danielroe removed their assignment Sep 6, 2023
@warflash
Copy link

warflash commented Mar 6, 2024

Hey @VicFleur, out of curiousity, have you stumbled across a workaround for this?

@VicFleur
Copy link
Author

VicFleur commented Mar 7, 2024

@warflash no, we ended up self-hosting the app instead. Looks like the "solution" would be avoiding the credentials field entirely when fetching content, but the issue isn't resolved in the linked threads either, as it's probably due to a bug or something missing on Cloudflare

@warflash
Copy link

warflash commented Mar 7, 2024

Appreciate the response!
Looking through the issues you linked the "fix" or rather workaround seems pretty straight foward actually. https://github.com/sindresorhus/ky/pull/559/files
@danielroe Do you think an approach like this would be fine for this module as well - or should this be fixed elsewhere instead?

@danielroe
Copy link
Collaborator

Interesting. I would certainly be up for hotfixing here but probably deserves to be in https://github.com/unjs/ofetch which we are using under the hood.

@danielroe
Copy link
Collaborator

Actually, I think we can just omit on the server. (Still should be raised upstream, but I think we have a local solution.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working upstream
Projects
None yet
Development

No branches or pull requests

3 participants