500 Error on Dynamic Next.js route

Im getting 500 errors from dynamic routes on my next site. THe pages load fine if they are navigated to from another page, however hitting the url directly results in a 500 error. this is not the case locally and everything loads as expected

function logs:

Oct 5, 01:15:20 PM: INIT_START Runtime Version: nodejs:18.v12	Runtime Version ARN: arn:aws:lambda:us-east-1::runtime:0bdff101a7b4e0589af824f244deb93200e4663c2a8d7d0148b76cd00c48777aOct 5, 01:15:22 PM: 78119fbc ERROR  Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './server.edge' is not defined by "exports" in /var/task/node_modules/react-dom/package.json
    at new NodeError (node:internal/errors:405:5)
    at exportsNotFound (node:internal/modules/esm/resolve:364:10)
    at packageExportsResolve (node:internal/modules/esm/resolve:700:9)
    at resolveExports (node:internal/modules/cjs/loader:567:36)
    at Module._findPath (node:internal/modules/cjs/loader:636:31)
    at Module._resolveFilename (node:internal/modules/cjs/loader:1063:27)
    at /var/task/.netlify/functions-internal/___netlify-handler/requireHooks.js:100:40
    at Module._load (node:internal/modules/cjs/loader:922:27)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
    at require (node:internal/modules/cjs/helpers:121:18) {
}Oct 5, 01:15:22 PM: 78119fbc INFO   [GET] /loan-dashboard/1 (SSR)Oct 5, 01:15:22 PM: 78119fbc Duration: 1534.63 ms	Memory Usage: 207 MB	Init Duration: 535.11 ms	Oct 5, 01:15:23 PM: fe6cade5 INFO   [GET] /favicon.ico (SSR)Oct 5, 01:15:23 PM: fe6cade5 Duration: 106.37 ms	Memory Usage: 207 MB	

client error:

main-f83a8b8998677b57.js:1 {name: 'Internal Server Error.', message: '500 - Internal Server Error.', statusCode: 500}message: "500 - Internal Server Error."name: "Internal Server Error."statusCode: 500[[Prototype]]: Objectconstructor: ƒ Object()hasOwnProperty: ƒ hasOwnProperty()isPrototypeOf: ƒ isPrototypeOf()propertyIsEnumerable: ƒ propertyIsEnumerable()toLocaleString: ƒ toLocaleString()toString: ƒ toString()valueOf: ƒ valueOf()__defineGetter__: ƒ __defineGetter__()__defineSetter__: ƒ __defineSetter__()__lookupGetter__: ƒ __lookupGetter__()__lookupSetter__: ƒ __lookupSetter__()__proto__: (...)get __proto__: ƒ __proto__()set __proto__: ƒ __proto__()
Q @ main-f83a8b8998677b57.js:1
el @ main-f83a8b8998677b57.js:1
eu @ main-f83a8b8998677b57.js:1
await in eu (async)
(anonymous) @ main-f83a8b8998677b57.js:1
Promise.then (async)
61019 @ main-f83a8b8998677b57.js:1
i @ webpack-335a27ec7061b5af.js:1
(anonymous) @ main-f83a8b8998677b57.js:1
i.O @ webpack-335a27ec7061b5af.js:1
(anonymous) @ main-f83a8b8998677b57.js:1
o @ webpack-335a27ec7061b5af.js:1
(anonymous) @ main-f83a8b8998677b57.js:1
main-f83a8b8998677b57.js:1 A client-side exception has occurred, see here for more info: https://nextjs.org/docs/messages/client-side-exception-occurred

error is pretty generic

build settings

Base directory
Package directory
Not set
Build command
yarn build
Publish directory
Functions directory
Build status

Site is behind a password, so cant share at the moment. Is it possible to view the access logs to see more details on the 500?

Ive tried, unsuccessfully to add the var suggested here

netlify env:set __NEXT_PRIVATE_PREBUNDLED_REACT next

nothing happens when setting from the CLI, and the UI says vars need to start with a letter.

has anyone solved this another way?

There’s no official way at the moment. Closing this in favour of the original post: Server.edge not defined Error on nextJS SSR functions cause site to return 500 Errors