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

[Cloudflare Pages] The 'cache' field on 'RequestInitializerDict' is not implemented. #173

Closed
samiy803 opened this issue May 8, 2024 · 8 comments
Assignees

Comments

@samiy803
Copy link

samiy803 commented May 8, 2024

On certain edge runtimes like Cloudflare (possibly others too), fetch() doesn't implement the cache field. As such, it produces an error:

// POST https://redacted.pages.dev/api/login
  "logs": [
    {
      "message": [
        {
          "code": "INTERNAL_ERROR",
          "message": "Internal error: The 'cache' field on 'RequestInitializerDict' is not implemented."
        }
      ],
      "level": "error",
      "timestamp": 1715189441063
    }
  ],

See: cloudflare/workerd#698

@samiy803
Copy link
Author

samiy803 commented May 8, 2024

Temporarily, can we add the feature to pass a custom fetch() function? Similar to: cloudflare/workerd#698 (comment)

@tstpierre
Copy link

Linking this PR thats in flight by James for next-on-pages cloudflare/next-on-pages#771

awinogrodzki added a commit that referenced this issue May 26, 2024
…to-cloudflare-issue

fix: remove fetch `cache: no-store` due to #173
github-actions bot pushed a commit that referenced this issue May 26, 2024
# [1.5.0-canary.2](v1.5.0-canary.1...v1.5.0-canary.2) (2024-05-26)

### Bug Fixes

* remove fetch `cache: no-store` due to #173 ([6fb8143](6fb8143))
@awinogrodzki awinogrodzki self-assigned this May 26, 2024
@awinogrodzki
Copy link
Owner

Hey!

Thanks for reporting @samiy803.

I've released a fix/workaround in [email protected]

More details about 1.5 can be found in #186

Could you test it and let me know if it works?

github-actions bot pushed a commit that referenced this issue May 30, 2024
# [1.5.0](v1.4.5...v1.5.0) (2024-05-30)

### Bug Fixes

* remove fetch `cache: no-store` due to #173 ([6fb8143](6fb8143))

### Features

* added refreshCredentials method that allows to pass modified request headers to NextResponse constructor ([2bf2877](2bf2877))
* extract referer from Next.js request headers ([bc666fa](bc666fa))
* introduced Firebase API Key domain restriction support. Introduced changes to advanced methods and removed APIs deprecated in 1.0 ([67dbb9a](67dbb9a))

### Performance Improvements

* **refreshCredentials:** slightly improve performance by generating signed tokens only once ([da2fc3e](da2fc3e))
@awinogrodzki
Copy link
Owner

awinogrodzki commented May 31, 2024

I will close the issue now, as 1.5 version has been released and cache: no-store is no longer passed to fetch method

@asaroukou
Copy link

Hi @awinogrodzki, I have a question about this update. Does it revert the changes required for this issue to be fixed #159. We didn't bumped the lib to the last version yet 😄.

@awinogrodzki
Copy link
Owner

Hey @asaroukou,

Yes, I've described the issue in this PR: #187

This PR removes the usages of cache fetch option

Due to above, it's recommended to update Next.js to v14 along with the upgrade to [email protected] to avoid caching issues

You need to update Next.js to version 14 before updating next-firebase-auth-edge to 1.5

@asaroukou
Copy link

You need to update Next.js to version 14 before updating next-firebase-auth-edge to 1.5

Ok so if I understand correctly the caching issue was only related to next 13. Since we already have the 14.x installed it should be fine to bump the lib to his last version.

@awinogrodzki
Copy link
Owner

Ok so if I understand correctly the caching issue was only related to next 13. Since we already have the 14.x installed it should be fine to bump the lib to his last version.

yes, exactly. The issue you faced in #159 was no longer reproducible in Next.js 14

KG0517 added a commit to KG0517/next-firebase-auth-edge that referenced this issue Oct 14, 2024
KG0517 pushed a commit to KG0517/next-firebase-auth-edge that referenced this issue Oct 14, 2024
KG0517 pushed a commit to KG0517/next-firebase-auth-edge that referenced this issue Oct 14, 2024
# [1.5.0](awinogrodzki/next-firebase-auth-edge@v1.4.5...v1.5.0) (2024-05-30)

### Bug Fixes

* remove fetch `cache: no-store` due to awinogrodzki/next-firebase-auth-edge#173 ([6fb8143](awinogrodzki/next-firebase-auth-edge@6fb8143))

### Features

* added refreshCredentials method that allows to pass modified request headers to NextResponse constructor ([2bf2877](awinogrodzki/next-firebase-auth-edge@2bf2877))
* extract referer from Next.js request headers ([bc666fa](awinogrodzki/next-firebase-auth-edge@bc666fa))
* introduced Firebase API Key domain restriction support. Introduced changes to advanced methods and removed APIs deprecated in 1.0 ([67dbb9a](awinogrodzki/next-firebase-auth-edge@67dbb9a))

### Performance Improvements

* **refreshCredentials:** slightly improve performance by generating signed tokens only once ([da2fc3e](awinogrodzki/next-firebase-auth-edge@da2fc3e))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants