Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Turbo: json-schema-to-typescript package errors (Cannot convert undefined or null to object) #66723

Closed
AlessioGr opened this issue Jun 10, 2024 · 2 comments
Labels
bug Issue was opened via the bug report template. linear: turbopack Confirmed issue that is tracked by the Turbopack team. locked Turbopack Related to Turbopack with Next.js.

Comments

@AlessioGr
Copy link
Contributor

AlessioGr commented Jun 10, 2024

Link to the code that reproduces this issue

https://github.com/AlessioGr/turbo-pkg-repro

To Reproduce

In my reproduction repo: run pnpm dev

From scratch:

  1. npx create-next-app@canary
  2. pnpm add json-schema-to-typescript
  3. import {compile} from 'json-schema-to-typescript' in the root layout
  4. Call that function in the root layout
  5. pnpm dev --turbo

Current vs. Expected behavior

Current: This works on webpack. On turbopack it throws the following error:

> next dev --turbo

  ▲ Next.js 15.0.0-canary.23 (turbo)
  - Local:        http://localhost:3000

 ✓ Starting...
 ✓ Ready in 1184ms
 ○ Compiling /_not-found/page ...
 ✓ Compiled /_not-found/page in 2.9s
 ⨯ TypeError: Cannot convert undefined or null to object
    at Function.assign (<anonymous>)
    at /Users/alessio/Documents/GitHub/reprot/.next/server/chunks/ssr/node_modules__pnpm_f51c9a._.js:8179:29
    at instantiateModule (/Users/alessio/Documents/GitHub/reprot/.next/server/chunks/ssr/[turbopack]_runtime.js:530:23)
    at getOrInstantiateModuleFromParent (/Users/alessio/Documents/GitHub/reprot/.next/server/chunks/ssr/[turbopack]_runtime.js:582:12)
    at esmImport (/Users/alessio/Documents/GitHub/reprot/.next/server/chunks/ssr/[turbopack]_runtime.js:132:20)
    at /Users/alessio/Documents/GitHub/reprot/.next/server/chunks/ssr/node_modules__pnpm_f51c9a._.js:8190:235
    at instantiateModule (/Users/alessio/Documents/GitHub/reprot/.next/server/chunks/ssr/[turbopack]_runtime.js:530:23)
    at getOrInstantiateModuleFromParent (/Users/alessio/Documents/GitHub/reprot/.next/server/chunks/ssr/[turbopack]_runtime.js:582:12)
    at esmImport (/Users/alessio/Documents/GitHub/reprot/.next/server/chunks/ssr/[turbopack]_runtime.js:132:20)
    at /Users/alessio/Documents/GitHub/reprot/.next/server/chunks/ssr/node_modules__pnpm_f51c9a._.js:8217:247
    at instantiateModule (/Users/alessio/Documents/GitHub/reprot/.next/server/chunks/ssr/[turbopack]_runtime.js:530:23)
    at getOrInstantiateModuleFromParent (/Users/alessio/Documents/GitHub/reprot/.next/server/chunks/ssr/[turbopack]_runtime.js:582:12)
    at commonJsRequire (/Users/alessio/Documents/GitHub/reprot/.next/server/chunks/ssr/[turbopack]_runtime.js:146:20)
    at Object.<anonymous> (/Users/alessio/Documents/GitHub/reprot/.next/server/chunks/ssr/fbfc9_@apidevtools_json-schema-ref-parser_dist_lib_f238c6._.js:1049:15)
    at instantiateModule (/Users/alessio/Documents/GitHub/reprot/.next/server/chunks/ssr/[turbopack]_runtime.js:530:23)
    at getOrInstantiateModuleFromParent (/Users/alessio/Documents/GitHub/reprot/.next/server/chunks/ssr/[turbopack]_runtime.js:582:12)
    at commonJsRequire (/Users/alessio/Documents/GitHub/reprot/.next/server/chunks/ssr/[turbopack]_runtime.js:146:20)
    at Object.<anonymous> (/Users/alessio/Documents/GitHub/reprot/.next/server/chunks/ssr/fbfc9_@apidevtools_json-schema-ref-parser_dist_lib_f238c6._.js:2884:35)
    at instantiateModule (/Users/alessio/Documents/GitHub/reprot/.next/server/chunks/ssr/[turbopack]_runtime.js:530:23)
    at getOrInstantiateModuleFromParent (/Users/alessio/Documents/GitHub/reprot/.next/server/chunks/ssr/[turbopack]_runtime.js:582:12)
    at commonJsRequire (/Users/alessio/Documents/GitHub/reprot/.next/server/chunks/ssr/[turbopack]_runtime.js:146:20)
    at Object.<anonymous> (/Users/alessio/Documents/GitHub/reprot/.next/server/chunks/ssr/node_modules__pnpm_f51c9a._.js:3494:34)
    at instantiateModule (/Users/alessio/Documents/GitHub/reprot/.next/server/chunks/ssr/[turbopack]_runtime.js:530:23)
    at getOrInstantiateModuleFromParent (/Users/alessio/Documents/GitHub/reprot/.next/server/chunks/ssr/[turbopack]_runtime.js:582:12)
    at commonJsRequire (/Users/alessio/Documents/GitHub/reprot/.next/server/chunks/ssr/[turbopack]_runtime.js:146:20)
    at Object.<anonymous> (/Users/alessio/Documents/GitHub/reprot/.next/server/chunks/ssr/node_modules__pnpm_f51c9a._.js:3669:20)
    at instantiateModule (/Users/alessio/Documents/GitHub/reprot/.next/server/chunks/ssr/[turbopack]_runtime.js:530:23)
    at getOrInstantiateModuleFromParent (/Users/alessio/Documents/GitHub/reprot/.next/server/chunks/ssr/[turbopack]_runtime.js:582:12)
    at esmImport (/Users/alessio/Documents/GitHub/reprot/.next/server/chunks/ssr/[turbopack]_runtime.js:132:20)
    at /Users/alessio/Documents/GitHub/reprot/.next/server/chunks/ssr/_ad62d2._.js:129:258
    at [project]/app/layout.tsx [app-rsc] (ecmascript) (/Users/alessio/Documents/GitHub/reprot/.next/server/chunks/ssr/_ad62d2._.js:205:3)
    at instantiateModule (/Users/alessio/Documents/GitHub/reprot/.next/server/chunks/ssr/[turbopack]_runtime.js:530:23)
    at getOrInstantiateModuleFromParent (/Users/alessio/Documents/GitHub/reprot/.next/server/chunks/ssr/[turbopack]_runtime.js:582:12)
    at esmImport (/Users/alessio/Documents/GitHub/reprot/.next/server/chunks/ssr/[turbopack]_runtime.js:132:20)
    at Module.default (/Users/alessio/Documents/GitHub/reprot/.next/server/chunks/ssr/_ad62d2._.js:209:20)
    at tree.layout (/Users/alessio/Documents/GitHub/reprot/.next/server/chunks/ssr/59b3a_next_dist_328f19._.js:3892:162)
digest: "2764682777"

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.5.0: Wed May  1 20:17:33 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6031
  Available memory (MB): 65536
  Available CPU cores: 16
Binaries:
  Node: 22.2.0
  npm: 8.19.4
  Yarn: 1.22.22
  pnpm: 8.15.8
Relevant Packages:
  next: 15.0.0-canary.23 // Latest available version is detected (15.0.0-canary.23).
  eslint-config-next: 15.0.0-canary.23
  react: 19.0.0-rc.0
  react-dom: 19.0.0-rc.0
  typescript: 5.4.5
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Turbopack

Which stage(s) are affected? (Select all that apply)

next dev (local)

Additional context

This is the line in the compiled/bundled JS output where it errors at:

const __TURBOPACK__default__export__ = __TURBOPACK__imported__module__$5b$project$5d2f$node_modules$2f2e$pnpm$2f40$jsdevtools$2b$ono$40$7$2e$1$2e$3$2f$node_modules$2f40$jsdevtools$2f$ono$2f$esm$2f$singleton$2e$js__$5b$app$2d$rsc$5d$__$28$ecmascript$29$__["ono"];
// CommonJS default export hack
if (typeof module === "object" && typeof module.exports === "object") {
    module.exports = Object.assign(module.exports.default, module.exports);
} //# sourceMappingURL=index.js.map
@AlessioGr AlessioGr added the bug Issue was opened via the bug report template. label Jun 10, 2024
@github-actions github-actions bot added the Turbopack Related to Turbopack with Next.js. label Jun 10, 2024
jmikrut pushed a commit to payloadcms/payload that referenced this issue Jun 10, 2024
JessChowdhury pushed a commit to payloadcms/payload that referenced this issue Jun 12, 2024
@ForsakenHarmony ForsakenHarmony added the linear: turbopack Confirmed issue that is tracked by the Turbopack team. label Jun 13, 2024
@lfades
Copy link
Member

lfades commented Sep 23, 2024

👋

I tested your demo and was able to reproduce the issue, but it disappeared after I upgraded to the latest canary and react beta:

  "dependencies": {
    "json-schema-to-typescript": "^14.0.5",
    "next": "15.0.0-canary.162",
    "react": "19.0.0-beta-26f2496093-20240514",
    "react-dom": "19.0.0-beta-26f2496093-20240514"
  },

I'll close the issue for now as it seems to be working fine but feel free to comment again if that's not the case.

@lfades lfades closed this as completed Sep 23, 2024
Copy link
Contributor

github-actions bot commented Oct 8, 2024

This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot added the locked label Oct 8, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 8, 2024
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
bug Issue was opened via the bug report template. linear: turbopack Confirmed issue that is tracked by the Turbopack team. locked Turbopack Related to Turbopack with Next.js.
Projects
None yet
Development

No branches or pull requests

3 participants