kit: Cannot read property 'split' of undefined - Netlify adapter

Describe the bug

When I upload my project I keep getting cannot read property of “split”.

I suspect this has something to do with the adapter and not of Svelte itself since I can run a dev server just fine.

For whatever it might be worth, here is my project in question - https://github.com/Bradley-H/portfolio

Reproduction

upload to netlify

Logs

No response

System Info

It uploads to netlify just fine, no problem

Severity

blocking an upgrade

Additional Information

No response

here is my website on netlify if you need it - https://bradley-portfolio.netlify.app/

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 2
  • Comments: 17 (7 by maintainers)

Most upvoted comments

I just moved that line of code: https://github.com/sveltejs/kit/pull/1916

Can y’all try @sveltejs/kit@1.0.0-next.131 and see if it works any better?

Hello, I am facing the same issue, I tried deploying my Sveltekit app on netlify, on visiting the app, https://sveltekit-pokedex.netlify.app/ it shows: Cannot read property 'split' of undefined

Here’s the netlify 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. If you want to see the web app’s code here it is: https://github.com/0xPiyush/sveltekit-pokedex

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"

netlify.toml file:

[build]
    command = "npm run build"
    publish = "build/"
    functions = "functions/"
[build.environment]
    NODE_VERSION = "14.17.2"