opennextjs-netlify: Bug: `appDir` applications can have `dataRoute: null`

When you run next build on https://github.com/redmonkez12/interactive-rating-component/tree/079f65a9b1d84efe2c1032dc01c022b46a7c0fb5, then prerender-manifest.json will contain

"/api/hello": {
    "initialHeaders": { "content-type": "text/plain;charset=UTF-8" },
    "initialRevalidateSeconds": false,
    "srcRoute": "/api/hello",
    "dataRoute": null
  }

Our runtime currently can’t handle that, and will throw an error here, because dataRoute is null:

https://github.com/netlify/next-runtime/blob/72ab895be865402fa0d92431f293129c70ae6c8b/packages/runtime/src/templates/edge-shared/rsc-data.ts#L38

To fix that, we should update the Next.js version that this repo is pulling TS types from, and fix all places where the types now fail.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 2
  • Comments: 27 (1 by maintainers)

Most upvoted comments

Yes

2:12:10 PM: ❯ Using Next.js Runtime - v4.34.0

Feels like this is a high priority so I’ve added it to the current iteration as an “up next”.

Screenshot 2023-04-13 at 11 52 20 AM Screenshot 2023-04-13 at 11 51 50 AM Here is the output of the build log in Netlify. I have your plugin locked at v4.34.0 in my dev dependencies and Next@13.3

Also facing the same issue image

@Fox32, apologies, but I mispoke. This fix didn’t roll out in v. 4.33.0. I’m adding it to the next release.

Upgraded to 4.33.0 today, still hitting the same error:

Packaging Edge Functions from .netlify\edge-functions directory:
 - rsc-data
Could not load edge function at 'C:\Users\Oliver\dev\blog\.netlify\edge-functions\rsc-data\rsc-data.ts'
TypeError: Cannot read properties of null (reading 'endsWith')
    at file:///C:/Users/Oliver/dev/blog/.netlify/edge-functions/edge-shared/rsc-data.ts:38:48
    at Array.filter (<anonymous>)
    at getRscDataRouter (file:///C:/Users/Oliver/dev/blog/.netlify/edge-functions/edge-shared/rsc-data.ts:38:8)
    at file:///C:/Users/Oliver/dev/blog/.netlify/edge-functions/rsc-data/rsc-data.ts:4:17

  Internal error during "Edge Functions bundling"
────────────────────────────────────────────────────────────────

  Error message
  TypeError: Expected a string

  Error location
  During Edge Functions bundling
      at module.exports (C:\Users\Oliver\dev\blog\node_modules\glob-to-regexp\index.js:3:11)
      at pathToRegularExpression (file:///C:/Users/Oliver/dev/blog/node_modules/@netlify/edge-bundler/dist/node/manifest.js:67:31)
      at getRegularExpression (file:///C:/Users/Oliver/dev/blog/node_modules/@netlify/edge-bundler/dist/node/manifest.js:78:12)
      at file:///C:/Users/Oliver/dev/blog/node_modules/@netlify/edge-bundler/dist/node/manifest.js:32:25
      at Array.forEach (<anonymous>)
      at generateManifest (file:///C:/Users/Oliver/dev/blog/node_modules/@netlify/edge-bundler/dist/node/manifest.js:27:18)
      at writeManifest (file:///C:/Users/Oliver/dev/blog/node_modules/@netlify/edge-bundler/dist/node/manifest.js:89:22)
      at bundle (file:///C:/Users/Oliver/dev/blog/node_modules/@netlify/edge-bundler/dist/node/bundler.js:73:28)
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
      at async coreStep (file:///C:/Users/Oliver/dev/blog/node_modules/@netlify/build/lib/plugins_core/edge_functions/index.js:35:30)