Support Forums

Cannot read property 'split' of undefined on visiting the deployed Sveltekit app

Hello, I tried deploying my Sveltekit app on netlify, on visiting the app,
it shows:
Cannot read property 'split' of undefined
Here’s the function logs:

4:12:50 PM: a210dba2 ERROR  TypeError: Cannot read property 'split' of undefined
    at parse_body (/var/task/index.js:2082:57)
    at respond (/var/task/index.js:2171:15)
    at render (/var/task/index.js:2495:10)
    at Runtime.handler (/var/task/index.js:2722:26)
    at Runtime.handleOnce (/var/runtime/Runtime.js:66:25)

The build succeeds and the website gets deployed but shows the above error, when testing locally using npm run build / npm run preview, the site works as intended, but shows the above error when deployed.

using svelte netlify adapter. https://www.npmjs.com/package/@sveltejs/adapter-netlify

node: v14.17.2
Dev Dependencies:

"@sveltejs/adapter-netlify": "^1.0.0-next.22",
"@sveltejs/kit": "next",
"autoprefixer": "^10.3.1",
"svelte": "^3.34.0",
"tailwindcss": "^2.2.4"

Welcome to Netlify @0xPiyush

Are you able to share your repository?


Unfortunately I don’t have an answer for this. I have seen numerous issues on this forum with Sveltekit, though this is the first of this nature (usually trailingSlash issues. The GitHub repo does note.

This is very experimental; the adapter API isn’t at all fleshed out, and things will definitely change.

Suggest you might have a look at Cannot read property 'split' of undefined - Netlify adapter · Issue #1911 · sveltejs/kit · GitHub which is a new issue and add your voice.

1 Like

Thank you, I will check it out.

1 Like

This was a problem in sveltekit and after reporting my issues in sveltejs github, this issue has been resolved in the latest release.


Hey there, @0xPiyush :wave: thanks for coming back and letting us know this is resolved!

1 Like