[Sucrose] unexpected isContextPassToFunction error
cybercoder-naj opened this issue · comments
What version of Elysia.JS is running?
1.1.1
What platform is your computer?
Linux 6.6.32-1-lts x86_64 unknown
What steps can reproduce the bug?
- Clone this repository
- Change the branch to
fix/onresponse-missing-function
- Change directory to preview,
cd preview/
- Run the code,
bun run src/index.ts
What is the expected behavior?
No warning message.
What do you see instead?
[Sucrose] unexpected isContextPassToFunction error, please report the following to the developer:
---
O)=
---
Additional information
No response
Confirmed fixed in 1.1.2.
With 1.1.1:
[Sucrose] unexpected isContextPassToFunction error, please report the following to the developer:
---
Y)=
---
@SaltyAom getting this under 1.1.3, using a mounted instance of Elysia:
[Sucrose] warning: unexpected isContextPassToFunction error, you may continue development as usual but please report the following to the developer:
--- body ---
{{request:J,path:j})=>X(new Request(a0(J.url,j.slice(Z)||"/"),J))
--- context ---
newRequest(a0(J.url, j.slice(Z)||"/"), J
yes having same issue aswell on nextjs build
Collecting page data ..[Sucrose] warning: unexpected isContextPassToFunction error, you may continue development as usual but please report the following to the developer
the issue still exist in 1.1.4
1.1.5 fixed it for me
Just in production
i solv with this pattern
If you're encountering this error in Sucrose, it often happens when you're not destructuring ctx properly in an async function.
.get("xxx", async (ctx): Promise => {
ctx.cookie; // This can cause the error
});
Can be fixed by correctly destructuring the cookie from ctx:
.get("xxx", async ({ cookie }): Promise => {
// Now you can use the cookie without issues
});
This change prevents the isContextPassToFunction error.