next-drupal
next-drupal copied to clipboard
The 'credentials' field on 'RequestInitializerDict' is not implemented when used in Cloudflare pages
Package containing the bug
I’m not sure
Describe the bug
Usage of fetcher with credentials attribute is breaking production build if deployed on Cloudflare pages.
Using:
- next-drupal: 2.0.0-beta.0
- next: 14.2.7
- @cloudflare/next-on-pages: 1.13.2
- wrangler: 3.73.0
Expected behavior
A clear and concise description of what you expected to happen.
Steps to reproduce:
- Use "getResourceCollection" or "getResourceByPath" calls to retrieve the data from Drupal
- Local development works fine and the issue goes unnoticed
- Deploy the project to Cloudflare pages
- The routes are broken 😢
Additional context
This is the issue reported https://github.com/cloudflare/workers-sdk/issues/2514 where it states that the Cloudflare workers do not support "credentials" property.
Can a workaround be implemented similar to this? E.g. check if it is supported and only then add or skip the "credentials" property alltogether.
const isCredentialsSupported = "credentials" in Request.prototype;
fetch("...", { credentials: isCredentialsSupported ? "include" : undefined })