solid-start icon indicating copy to clipboard operation
solid-start copied to clipboard

[Bug?]: `export { POST as GET }` is now broken

Open samualtnorman opened this issue 1 year ago • 0 comments

Duplicates

  • [X] I have searched the existing issues

Latest version

  • [X] I have tested the latest version

Current behavior 😯

[h3] [unhandled] TypeError: fn2 is not a function
    at eval (/tmp/tmp.cE85ExhNff/solid-project/node_modules/.pnpm/@[email protected][email protected][email protected]_@[email protected][email protected][email protected]._4j6ut5gr2pxbf4za75tzgblw4q/node_modules/@solidjs/start/dist/server/handler.js:38:29)
    ... 4 lines matching cause stack trace ...
    at async Server.toNodeHandle (file:///tmp/tmp.cE85ExhNff/solid-project/node_modules/.pnpm/[email protected]/node_modules/h3/dist/index.mjs:2249:7) {
  cause: TypeError: fn2 is not a function
      at eval (/tmp/tmp.cE85ExhNff/solid-project/node_modules/.pnpm/@[email protected][email protected][email protected]_@[email protected][email protected][email protected]._4j6ut5gr2pxbf4za75tzgblw4q/node_modules/@solidjs/start/dist/server/handler.js:38:29)
      at async _callHandler (file:///tmp/tmp.cE85ExhNff/solid-project/node_modules/.pnpm/[email protected]/node_modules/h3/dist/index.mjs:1821:16)
      at async _callHandler (file:///tmp/tmp.cE85ExhNff/solid-project/node_modules/.pnpm/[email protected]/node_modules/h3/dist/index.mjs:1821:16)
      at async file:///tmp/tmp.cE85ExhNff/solid-project/node_modules/.pnpm/[email protected]/node_modules/h3/dist/index.mjs:1962:19
      at async Object.callAsync (file:///tmp/tmp.cE85ExhNff/solid-project/node_modules/.pnpm/[email protected]/node_modules/unctx/dist/index.mjs:72:16)
      at async Server.toNodeHandle (file:///tmp/tmp.cE85ExhNff/solid-project/node_modules/.pnpm/[email protected]/node_modules/h3/dist/index.mjs:2249:7),
  statusCode: 500,
  fatal: false,
  unhandled: true,
  statusMessage: undefined,
  data: undefined
}

Expected behavior 🤔

not throw error

Steps to reproduce 🕹

src/routes/foo.tsx

export function POST() {
	return new Response(`foo`)
}

export { POST as GET }

Try and visit the route.

Context 🔦

Back on SolidStart 0.3 I used to be able to handle both GET and POST requests using the same function using the above code. This is now broken that we've upgraded to 1.0.

Your environment 🌎

System:
    OS: NixOS 24.05.5860.89172919243d (Uakari) x86_64
    CPU: 12th Gen Intel(R) Core(TM) i5-12500 (12) @ 4.60 GHz
Binaries:
    Node: v22.10.0
    PNPM: 9.12.2
npmPackages:
    @solidjs/meta 0.29.4
    @solidjs/router 0.14.10
    @solidjs/start 1.0.9
    solid-js 1.9.3
    vinxi: 0.4.3

samualtnorman avatar Oct 23 '24 09:10 samualtnorman