Skip to content

[BUG] TypeError: Cannot read properties of undefined (reading 'split') #473

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

Closed
canuysal opened this issue Mar 18, 2025 · 6 comments
Closed
Labels
bug Something isn't working

Comments

@canuysal
Copy link

canuysal commented Mar 18, 2025

Describe the bug

After following the tutorial steps, I'm receiving this error when visiting any page on the site:

Cannot read properties of undefined (reading 'split')

or sometimes this:

TypeError: Cannot read properties of undefined (reading 'run')

Error is only produced on yarn preview or yarn deploy, no issues with yarn dev.

Any ideas why this might happen, and is there a way to debug this better? Since the code is already compiled I can't track the source of the issue

at 77637 (file:///.../frontend/site/.open-next/server-functions/default/handler.mjs:68682:42) at t (file:///.../frontend/site/.open-next/server-functions/default/handler.mjs:75044:16) at 57083 ...

I tried removing .next and .node-modules.

Steps to reproduce

Visiting the / after yarn dev produces the error codes above.

I'm not sure if you can reproduce it without my repository, but here are some versions:

Next.js version : 14.2.25
opennextjs/cloudflare version: 0.5.12
Yarn version: 1.22.22
Node version: v20.19.0

Expected behavior

No error codes from backend

@opennextjs/cloudflare version

0.5.2

Wrangler version

4.1.0

next info output

(node:266883) [MODULE_TYPELESS_PACKAGE_JSON] Warning: Module type of file:///repository/frontend/site/next.config.js is not specified and it doesn't parse as CommonJS.
Reparsing as ES module because module syntax was detected. This incurs a performance overhead.
To eliminate this warning, add "type": "module" to /repository/frontend/site/package.json.
(Use `node --trace-warnings ...` to show where the warning was created)
warning ../../package.json: No license field
This project is configured to use yarn because /repository/package.json has a "packageManager" field

Operating System:
  Platform: linux
  Arch: x64
  Version: #18-Ubuntu SMP PREEMPT_DYNAMIC Fri Feb  7 22:34:25 UTC 2025
  Available memory (MB): 23462
  Available CPU cores: 8
Binaries:
  Node: 20.19.0
  npm: 10.8.2
  Yarn: 1.22.22
  pnpm: N/A
Relevant Packages:
  next: 14.2.25 // An outdated version detected (latest is 15.2.3), upgrade is highly recommended!
  eslint-config-next: 13.5.8
  react: 18.3.1
  react-dom: 18.3.1
  typescript: 5.8.2
Next.js Config:
  output: N/A
 ⚠ An outdated version detected (latest is 15.2.3), upgrade is highly recommended!
   Please try the latest canary version (`npm install next@canary`) to confirm the issue still exists before creating a new issue.
   Read more - https://nextjs.org/docs/messages/opening-an-issue
Done in 2.02s.

Additional context

I also used opennext/sst before this repository to deploy on AWS. That may have a conflict?

@canuysal canuysal added bug Something isn't working triage labels Mar 18, 2025
@sommeeeer
Copy link

I think this is related to process.versions.node being undefined in workers. We had a discussion about it in a discord thread here: https://discord.com/channels/1283128968140161065/1288871672035803236/1350536144563077221

@canuysal
Copy link
Author

@sommeeeer I saw the thread before opening the ticket, two other people in there reported the same issue with different node versions but no resolutions so far. Is there a way to fix process.versions.node being undefined on workers? I'm using nvm if that matters.

@JasonGiedymin
Copy link

Another user here with that error:

Image

Nearly same deps as OP.

@vicb
Copy link
Contributor

vicb commented Mar 19, 2025

Thanks @sommeeeer to link the root cause (process.versions.node).

We are looking into the best way to solve this - The idea would be that unenv (the polyfill we use to bridge the gaps with Node) provides this value. I need to look at what would be the best value (i.e. a given version or an empty string).

@jasminmistry
Copy link

I am facing same issue but couldnt able to find temporary solution

@vicb
Copy link
Contributor

vicb commented Apr 1, 2025

This should have been resolved via #520 released in 0.6.6

Please re-open if you still have some issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

5 participants