liuweiGL / vite-plugin-mkcert

Provide certificates for vite's https dev service.
https://www.npmjs.com/package/vite-plugin-mkcert
MIT License
540 stars 37 forks source link

Doesn't work with latest svelte-kit #89

Open callmeberzerker opened 3 weeks ago

callmeberzerker commented 3 weeks ago

Describe the bug

Doesn't work with svelte-kit latest version. (see system info below)

TypeError: Could not convert argument of type symbol to string.
    at webidl.converters.DOMString (node:internal/deps/undici/undici:1977:15)
    at webidl.converters.ByteString (node:internal/deps/undici/undici:1982:35)
    at Object.record<ByteString, ByteString> (node:internal/deps/undici/undici:1894:30)
    at webidl.converters.HeadersInit (node:internal/deps/undici/undici:3424:67)
    at Object.RequestInit (node:internal/deps/undici/undici:1951:21)
    at new Request (node:internal/deps/undici/undici:4835:34)
    at getRequest (file:///Users/spase/Private/chaos/node_modules/.pnpm/@sveltejs+kit@2.5.10_@sveltejs+vite-plugin-svelte@3.1.1_svelte@5.0.0-next.150_vite@5.2.12__sv_4ftxfejhmyxz2tcfri6oisklcy/node_modules/@sveltejs/kit/src/exports/node/index.js:107:9)
    at file:///Users/spase/Private/chaos/node_modules/.pnpm/@sveltejs+kit@2.5.10_@sveltejs+vite-plugin-svelte@3.1.1_svelte@5.0.0-next.150_vite@5.2.12__sv_4ftxfejhmyxz2tcfri6oisklcy/node_modules/@sveltejs/kit/src/exports/vite/dev/index.js:497:27
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Reproduction

  1. clone https://github.com/callmeberzerker/mkcert-demo
  2. cd into the dir and run pnpm install
  3. run pnpm dev
  4. open https://localhost:5173/ in the browser and observe the stack trace
  5. as @konstantinblaesi mentioned below it can be fixed by adding the proxy bit -> but that is optional

System Info

Output of npx envinfo --system --npmPackages vite,vite-plugin-mkcert --binaries --browsers:

  System:
    OS: macOS 14.5
    CPU: (10) arm64 Apple M1 Pro
    Memory: 84.59 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.13.1 - ~/.nvm/versions/node/v20.13.1/bin/node
    npm: 10.5.2 - ~/.nvm/versions/node/v20.13.1/bin/npm
    pnpm: 9.2.0 - ~/Library/pnpm/pnpm
  Browsers:
    Chrome: 125.0.6422.142
    Safari: 17.5
  npmPackages:
    vite: ^5.2.12 => 5.2.12 
    vite-plugin-mkcert: ^1.17.5 => 1.17.5 

Used package manager: pnpm

Logs

liuweiGL commented 3 weeks ago

Sorry, I didn't use svelte

konstantinblaesi commented 3 weeks ago

I use it in all my sveltekit projects and have no issues, newer node versions require setting proxy like this

export default defineConfig({
    server: { proxy: {} }
});

I think this broke somewhere between node 20.10 and 20.12. Also make sure you do not have a pnpm node version / node_modules mess (different versions mixing)

callmeberzerker commented 3 weeks ago

I use it in all my sveltekit projects and have no issues, newer node versions require setting proxy like this

export default defineConfig({
  server: { proxy: {} }
});

I think this broke somewhere between node 20.10 and 20.12. Also make sure you do not have a pnpm node version / node_modules mess (different versions mixing)

I can confirm that this fixes it, thanks for that! It should work w/o the proxy bit so providing a repro momentarily...

callmeberzerker commented 3 weeks ago

@liuweiGL reproduction attached to the original issue description.