[go: nahoru, domu]

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

[Bug?]: server function that contain await prisma function will throws error #1514

Closed
2 tasks done
Huliiiiii opened this issue May 27, 2024 · 3 comments
Closed
2 tasks done
Labels
bug Something isn't working

Comments

@Huliiiiii
Copy link
Huliiiiii commented May 27, 2024

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Current behavior 😯

async function WithOutAwait(){
	"use server"
	prisma.$executeRaw`SELECT * From User`;
	return console.log("WithOutAwait: ok");

}

async function WithAwait(){
	"use server"
	await prisma.$executeRaw`SELECT * From User`;
	return console.log("WithAwait: ok");
}

<button onClick={()=>WithOutAwait()} /> 
// Click: WithOutAwait: ok
<button onClick={()=>WithAwait()} /> 
// Click: Error:
// [nitro] [request error] [unhandled] Invalid character in header content ["X-Error"]
//   at ServerResponse.setHeader (node:_http_outgoing:706:3)
//   at setResponseHeader (/D:/**/solid-project/.output/server/chunks/runtime.mjs:2528:18)
//   at /D:/**/solid-project/.output/server/chunks/runtime.mjs:5724:1057
//   at Object.ye$1 [as handler] (/D:/**/solid-project/.output/server/chunks/runtime.mjs:6067:6371)
//   at async /D:/**/solid-project/.output/server/chunks/runtime.mjs:3039:19
//   at async Object.callAsync (/D:/**/solid-project/.output/server/chunks/runtime.mjs:5340:16)
//   at async Server.toNodeHandle (/D:/**/solid-project/.output/server/chunks/runtime.mjs:3305:7)

Expected behavior 🤔

The second button should work like the first.

Steps to reproduce 🕹

Copy code in solid-start template with prisma can reproduce this.

Context 🔦

No response

Your environment 🌎

OS: Microsoft Windows [version 10.0.22631.3593]
Node: 21.6.1
Bun: 1.1.10 (use as package manager)
Pnpm: 9.1.2
Solid-Start: 1.0.0
@Huliiiiii Huliiiiii added the bug Something isn't working label May 27, 2024
@lxsmnsyc
Copy link
Member

Whether or not the use of await is there is irrelevant, seems like there's an included header with invalid characters.

@lxsmnsyc
Copy link
Member

@ryansolid seems like the X-Error setHeader needs some character sanitation

@ryansolid
Copy link
Member

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants