#Async function stopped working (inside form onSubmit)

3 messages · Page 1 of 1 (latest)

urban niche
#

I have a simple login form using nextjs and react-hook-form. In the on submit function, I call a server action. It has been working perfectly, but all of a sudden I get this error when trying to submit

Uncaught (in promise) SyntaxError: await is only valid in async functions and the top level bodies of modules

I dont understand why I am getting this error all of a sudden. Here is the code

All my other server actions being called from the client are also not working?
Nextjs 14.2.5

cosmic whaleBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

urban niche
#

I have another project where this code works absolutely fine....