Skip to content
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

SSR is case sensitive for headers (content-type) #1463

Closed
Max9403 opened this issue May 16, 2021 · 0 comments · Fixed by #1594
Closed

SSR is case sensitive for headers (content-type) #1463

Max9403 opened this issue May 16, 2021 · 0 comments · Fixed by #1594

Comments

@Max9403
Copy link

Max9403 commented May 16, 2021

Describe the bug
The content-type header field is case-sensitive, adding graphql to a clean project will cause it to error with Cannot read property 'split' of undefined but making it fully lower case manually allows it to function as expected

Graphql adds a fetch in load with the content type header named as Content-Type making it lower case makes it work

Logs

Log > svelte-kit dev

Debugger listening on ws://127.0.0.1:57865/df48eb33-d329-4a79-983a-6807c41c0db1
For help, see: https://nodejs.org/en/docs/inspector
Debugger attached.

SvelteKit v1.0.0-next.107

network: not exposed
network: not exposed
network: not exposed
local: http://localhost:3000
network: not exposed
network: not exposed

Use --host to expose server to other devices on this network

A component can only have one <script context="module"> element
ParseError: A component can only have one <script context="module"> element
at error (E:\dev\rafael\IOT\webobtron\node_modules.pnpm\svelte@3.38.2\node_modules\svelte\compiler.js:16752:20)
at Parser$1.error (E:\dev\rafael\IOT\webobtron\node_modules.pnpm\svelte@3.38.2\node_modules\svelte\compiler.js:16828:10)
at parse$3 (E:\dev\rafael\IOT\webobtron\node_modules.pnpm\svelte@3.38.2\node_modules\svelte\compiler.js:16937:17)
at compile (E:\dev\rafael\IOT\webobtron\node_modules.pnpm\svelte@3.38.2\node_modules\svelte\compiler.js:30012:18)
at compileSvelte (E:\dev\rafael\IOT\webobtron\node_modules.pnpm@sveltejs+vite-plugin-svelte@1.0.0-next.10_svelte@3.38.2+vite@2.3.2\node_modules@sveltejs\vite-plugin-svelte\dist\index.js:244:48)
at async TransformContext.transform (E:\dev\rafael\IOT\webobtron\node_modules.pnpm@sveltejs+vite-plugin-svelte@1.0.0-next.10_svelte@3.38.2+vite@2.3.2\node_modules@sveltejs\vite-plugin-svelte\dist\index.js:837:27)
at async Object.transform (E:\dev\rafael\IOT\webobtron\node_modules.pnpm\vite@2.3.2\node_modules\vite\dist\node\chunks\dep-efbff8d5.js:44155:30)
at async transformRequest (E:\dev\rafael\IOT\webobtron\node_modules.pnpm\vite@2.3.2\node_modules\vite\dist\node\chunks\dep-efbff8d5.js:58421:29)
at async instantiateModule (E:\dev\rafael\IOT\webobtron\node_modules.pnpm\vite@2.3.2\node_modules\vite\dist\node\chunks\dep-efbff8d5.js:68026:10)
12:38:32 [vite] page reload src/routes/index.svelte
Cannot read property 'split' of undefined
TypeError: Cannot read property 'split' of undefined
at parse_body (file:///E:/dev/webobtron/node_modules/.pnpm/@sveltejs+kit@1.0.0-next.107_svelte@3.38.2/node_modules/@sveltejs/kit/dist/ssr.js:1383:60)
at respond (file:///E:/dev/webobtron/node_modules/.pnpm/@sveltejs+kit@1.0.0-next.107_svelte@3.38.2/node_modules/@sveltejs/kit/dist/ssr.js:1514:11)
at fetch (file:///E:/dev/webobtron/node_modules/.pnpm/@sveltejs+kit@1.0.0-next.107_svelte@3.38.2/node_modules/@sveltejs/kit/dist/ssr.js:731:30)
at load (index.svelte:13:30)
at load_node (file:///E:/dev/webobtron/node_modules/.pnpm/@sveltejs+kit@1.0.0-next.107_svelte@3.38.2/node_modules/@sveltejs/kit/dist/ssr.js:818:30)
at respond$1 (file:///E:/dev/webobtron/node_modules/.pnpm/@sveltejs+kit@1.0.0-next.107_svelte@3.38.2/node_modules/@sveltejs/kit/dist/ssr.js:1039:21)
at async render_page (file:///E:/dev/webobtron/node_modules/.pnpm/@sveltejs+kit@1.0.0-next.107_svelte@3.38.2/node_modules/@sveltejs/kit/dist/ssr.js:1186:20)
at async render (file:///E:/dev/webobtron/node_modules/.pnpm/@sveltejs+kit@1.0.0-next.107_svelte@3.38.2/node_modules/@sveltejs/kit/dist/ssr.js:1537:10)
at async Object.handle (e:/dev/webobtron/src/hooks.ts:14:24)
at async respond (file:///E:/dev/webobtron/node_modules/.pnpm/@sveltejs+kit@1.0.0-next.107_svelte@3.38.2/node_modules/@sveltejs/kit/dist/ssr.js:1510:10)
Unexpected token T in JSON at position 0
SyntaxError: Unexpected token T in JSON at position 0
at JSON.parse ()
at Proxy. (file:///E:/dev/webobtron/node_modules/.pnpm/@sveltejs+kit@1.0.0-next.107_svelte@3.38.2/node_modules/@sveltejs/kit/dist/ssr.js:790:22)
at async load (index.svelte:22:33)
at async load_node (file:///E:/dev/webobtron/node_modules/.pnpm/@sveltejs+kit@1.0.0-next.107_svelte@3.38.2/node_modules/@sveltejs/kit/dist/ssr.js:818:12)
at async respond$1 (file:///E:/dev/webobtron/node_modules/.pnpm/@sveltejs+kit@1.0.0-next.107_svelte@3.38.2/node_modules/@sveltejs/kit/dist/ssr.js:1039:15)
at async render_page (file:///E:/dev/webobtron/node_modules/.pnpm/@sveltejs+kit@1.0.0-next.107_svelte@3.38.2/node_modules/@sveltejs/kit/dist/ssr.js:1186:20)
at async render (file:///E:/dev/webobtron/node_modules/.pnpm/@sveltejs+kit@1.0.0-next.107_svelte@3.38.2/node_modules/@sveltejs/kit/dist/ssr.js:1537:10)
at async Object.handle (e:/dev/webobtron/src/hooks.ts:14:24)
at async respond (file:///E:/dev/webobtron/node_modules/.pnpm/@sveltejs+kit@1.0.0-next.107_svelte@3.38.2/node_modules/@sveltejs/kit/dist/ssr.js:1510:10)
at async Immediate. (file:///E:/dev/webobtron/node_modules/.pnpm/@sveltejs+kit@1.0.0-next.107_svelte@3.38.2/node_modules/@sveltejs/kit/dist/chunks/index.js:3305:23)

To Reproduce
npm init svelte@next
npx svelte-add graphql
npm run dev
open http://localhost:3000

Expected behavior
It to parse content-type header correctly

Stacktraces

Stack trace

Cannot read property 'split' of undefined
TypeError: Cannot read property 'split' of undefined
at parse_body (file:///E:/dev/webobtron/node_modules/.pnpm/@sveltejs+kit@1.0.0-next.107_svelte@3.38.2/node_modules/@sveltejs/kit/dist/ssr.js:1383:60)
at respond (file:///E:/dev/webobtron/node_modules/.pnpm/@sveltejs+kit@1.0.0-next.107_svelte@3.38.2/node_modules/@sveltejs/kit/dist/ssr.js:1514:11)
at fetch (file:///E:/dev/webobtron/node_modules/.pnpm/@sveltejs+kit@1.0.0-next.107_svelte@3.38.2/node_modules/@sveltejs/kit/dist/ssr.js:731:30)
at load (index.svelte:13:30)
at load_node (file:///E:/dev/webobtron/node_modules/.pnpm/@sveltejs+kit@1.0.0-next.107_svelte@3.38.2/node_modules/@sveltejs/kit/dist/ssr.js:818:30)
at respond$1 (file:///E:/dev/webobtron/node_modules/.pnpm/@sveltejs+kit@1.0.0-next.107_svelte@3.38.2/node_modules/@sveltejs/kit/dist/ssr.js:1039:21)
at async render_page (file:///E:/dev/webobtron/node_modules/.pnpm/@sveltejs+kit@1.0.0-next.107_svelte@3.38.2/node_modules/@sveltejs/kit/dist/ssr.js:1186:20)
at async render (file:///E:/dev/webobtron/node_modules/.pnpm/@sveltejs+kit@1.0.0-next.107_svelte@3.38.2/node_modules/@sveltejs/kit/dist/ssr.js:1537:10)
at async Object.handle (e:/dev/webobtron/src/hooks.ts:14:24)
at async respond (file:///E:/dev/webobtron/node_modules/.pnpm/@sveltejs+kit@1.0.0-next.107_svelte@3.38.2/node_modules/@sveltejs/kit/dist/ssr.js:1510:10)

Information about your SvelteKit Installation:

Diagnostics

System:
OS: Windows 10 10.0.19042
CPU: (16) x64 Intel(R) Core(TM) i7-7820X CPU @ 3.60GHz
Memory: 37.30 GB / 63.68 GB
Binaries:
Node: 15.9.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.10 - ~\AppData\Roaming\npm\yarn.CMD
npm: 7.12.1 - C:\Program Files\nodejs\npm.CMD
Watchman: 20210110.135312.0 - E:\dev\tools\watchman\bin\watchman.EXE
Browsers:
Edge: Spartan (44.19041.964.0), Chromium (90.0.818.62)
Internet Explorer: 11.0.19041.1
npmPackages:
@sveltejs/kit: next => 1.0.0-next.107
svelte: ^3.38.2 => 3.38.2

  • Your browser
    Firefox nightly

  • Your adapter (e.g. Node, static, Vercel, Begin, etc...)
    The default?

Severity
Annoying

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant