Skip to content

Cannot read properties of undefined (reading 'call') #15104

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

Open
ambrt opened this issue Jan 24, 2025 · 7 comments
Open

Cannot read properties of undefined (reading 'call') #15104

ambrt opened this issue Jan 24, 2025 · 7 comments
Labels
awaiting submitter needs a reproduction, or clarification

Comments

@ambrt
Copy link

ambrt commented Jan 24, 2025

Describe the bug

It works in browser and Astro's npm run dev .
I'm getting this error when trying to test with Vitest of Astro page with svelte file.

TypeError: Cannot read properties of undefined (reading 'call')
 
// edited - moved to Logs section

Reproduction

If required then later might try to repro. Its big page with runes, functions passed as props and template.
EDIT:
https://stackblitz.com/edit/github-ch9tapzs?file=test%2Fhappy-dom-env.test.ts&on=stackblitz
After dependencies install, stop npm in terminal and run npm run test

Logs

TypeError: Cannot read properties of undefined (reading 'call')
 ❯ get_first_child node_modules/svelte/src/internal/client/dom/operations.js:81:28
     80| /**
     81|  * @template {Node} N
     82|  * @param {N} node
       |      ^
     83|  * @returns {Node | null}
     84|  */
 ❯ eval node_modules/svelte/src/internal/client/dom/template.js:48:91
 ❯ eval node_modules/svelte/src/internal/client/dev/elements.js:13:15
 ❯ Test src/components/test.svelte:15:12
 ❯ render node_modules/svelte/src/internal/server/index.js:121:2
 ❯ Object.renderToStaticMarkup node_modules/@astrojs/svelte/server.js:45:49
 ❯ renderFrameworkComponent node_modules/astro/dist/runtime/server/render/component.js:189:68
 ❯ renderComponent node_modules/astro/dist/runtime/server/render/component.js:368:10

System Info

System:
    OS: Linux 5.15 Ubuntu 22.04.5 LTS 22.04.5 LTS (Jammy Jellyfish)
    CPU: (2) x64 Intel(R) Core(TM)2 Duo CPU     E4500  @ 2.20GHz
    Memory: 464.32 MB / 3.82 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 20.11.1 - ~/.nvm/versions/node/v20.11.1/bin/node
    Yarn: 1.22.17 - /usr/local/bin/yarn
    npm: 10.2.4 - ~/.nvm/versions/node/v20.11.1/bin/npm
    pnpm: 9.15.2 - ~/.local/share/pnpm/pnpm
    bun: 1.1.6 - ~/.bun/bin/bun
    Watchman: 20201115.021953.0 - /usr/local/bin/watchman
  Browsers:
    Chrome: 132.0.6834.83
  npmPackages:
    svelte: ^5.1.3 => 5.16.2

Severity

blocking all usage of svelte

@Conduitry Conduitry added the awaiting submitter needs a reproduction, or clarification label Jan 24, 2025
@Conduitry
Copy link
Member

A reproduction is required, yes.

@ambrt
Copy link
Author

ambrt commented Jan 26, 2025

@Conduitry

Repro:
https://stackblitz.com/edit/github-ch9tapzs?file=test%2Fhappy-dom-env.test.ts&on=stackblitz
(After dependencies install, stop npm in terminal and run npm run test)

Error happens in happy-dom and jsdom environments.

JSDom, throws same error as happy-dom , but since stackblitz has node v18, JSDom would fail with non svelte related issue.
So only happy-dom test is in the repro.

Test passes in plain node environment.

@Gbps
Copy link

Gbps commented Mar 25, 2025

I was getting this problem when I installed axios-retry. It seems to interact poorly with Sveltekit because it modifies the functions in the dependency of axios directly. Removing the package fixed the issue.

@ambrt
Copy link
Author

ambrt commented Apr 3, 2025

@Gbps Thanks for writing. Astro doesn't use SvelteKit, just Svelte alone but maybe there's culprit in axios-retry

@ambrt
Copy link
Author

ambrt commented Apr 5, 2025

@Conduitry pinging since repro is provided.

@davyzhang
Copy link

davyzhang commented Apr 11, 2025

read properties of undefined (reading 'call')
    at get_first_child (chunk-CWO6IWAX.js?v=9ddc4299:1283:29)
    at chunk-YCK63UA3.js?v=9ddc4299:146:9
    at chunk-ZQUM5PSP.js?v=9ddc4299:230:17
    at Root (root.svelte:42:41)

reproduce step:

  1. create a new sveltekit project
  2. npm install tailwindcss@latest @tailwindcss/vite@latest daisyui@latest

it's worked fine before, I guess something happens with the latest daisyui or vite

@akkie
Copy link

akkie commented Apr 11, 2025

I also have this problem from time to time. For me it helps to delete my node_modules and .svelte-kit folder and reinstall all dependencies. It happens sporadically during development. I also use tailwind and daisyui. But I'm sure it happened with the old versions too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting submitter needs a reproduction, or clarification
Projects
None yet
Development

No branches or pull requests

5 participants