next.js icon indicating copy to clipboard operation
next.js copied to clipboard

Next.js 13 data fetching hints not available in edge runtime

Open lenis0012 opened this issue 3 years ago • 0 comments

Verify canary release

  • [X] I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP Mon Sep 19 19:14:52 UTC 2022
Binaries:
  Node: 16.13.1
  npm: 8.19.2
  Yarn: 1.22.15
  pnpm: 6.11.0
Relevant packages:
  next: 13.0.1-canary.0
  eslint-config-next: 13.0.0
  react: 18.2.0
  react-dom: 18.2.0

What browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

Vercel

Describe the Bug

When trying to create a SSR/dynamic web page using the edge runtime in next.js 13 An error is thrown on every request

Error: The 'cache' field on 'RequestInitializerDict' is not implemented.
    at worker.js:62:4950
    at worker.js:10:16038
    at <anonymous>
    at worker.js:1:93
    at worker.js:1:405
    at worker.js:1:555
    at <anonymous>
    at worker.js:1:317
    at worker.js:10:16134
    at worker.js:10:15950

nextjs correctly identifies the page as dynamic/ssr (because of cache: no-store) But the edge runtime does not understand the modified fetch directive

Expected Behavior

fetch behaves as expected (either by implementing custom directive in edge runtime or by stripping it at compile time)

It is worth noting that nowhere in the beta documentation (https://beta.nextjs.org/docs/data-fetching/fetching) does it state that the new data fetching system is not compatible with edge runtime

Link to reproduction

https://github.com/lenis0012/next-13-edge-example

To Reproduce

  • $ git clone https://github.com/lenis0012/next-13-edge-example
  • $ cd next-13-edge-runtime
  • edit the absolute url in app/page.js
  • $ vercel deploy

lenis0012 avatar Oct 27 '22 16:10 lenis0012