-
-
Notifications
You must be signed in to change notification settings - Fork 56
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
formAction$ appears not to bundle correctly #254
Comments
This is a known issue that I plan to address in the coming months. See this issue. As a workaround, I recommend wrapping all of your formAction$<LoginForm>(() => {
if (isServer) {
const sql = postgres("postgresql://postgres:[email protected]:5432/cupon");
const db = drizzle(sql);
}
}, valiForm$(LoginSchema)); |
After hours of debugging, I found this issue to be the root cause of too much being bundled for the client in my application. The workaround works. I prefer the early return pattern, though: formAction$<LoginForm>(() => {
if (isBrowser) return;
// ...
}, valiForm$(LoginSchema)); With this workaround I still get a warning that |
Hello, here is a repo with simple reproduction: https://github.com/rafalfigura/qwik-bundles-pg-in-client-dist I've also tried to migrate from pg to mysql2 and it still had the same issue. |
I am very sorry about this problem. I still plan to submit a PR to Qwik and fix this. I hope to have time to do this by the end of the year. |
Thanks for sharing solutions, this worked for me in the meantime: if (isBrowser) throw new Error('...') |
Found this issue when trying to integrate drizzle using the following guide.
The problem is when using the database connection within a formAction$ like in the following example
One will get this error (Full log can be found here). It is my understanding from the documentation that formAction$ is executed on the server. Note that executing the same function within a server$, for an example will not lead to any issues. The error will also only occur when building the qwik app.
A temporary solution I've found is simply using the server$, and passing it as the function for the formAction$, but this will make TypeScript pretty mad.
The text was updated successfully, but these errors were encountered: