Open Jaydeep189 opened 1 year ago
Hi @Jaydeep189 you are using the edge runtime?
I am running this locally, via api route provided in nextjs.
I guess it uses edge runtime but I am not sure.
@Jaydeep189 i released a new version (1.5.0) with it the signUpHandler
can be used on the edge and with the new route handlers (app dir), can you try again with the new version?.
I think this may be related because in the edge there is no req.body
If it doesn't work, can you create a repo to reproduce the bug? because i tried again and everything works fine.
I am using Nextjs (12.2.5) version which does not include the app dir, I have reproduced the error in a new repository that I am sharing with you
Ok this is very strange, I cloned the repo, added the environment variables and started the development server and all works fine. I also tried with Next.js 12.2.5 and it works as well.
Oh, I didn't check it with postman as a stand alone post request, it works completely fine there, but when I am using this
import { signUp } from 'next-auth-sanity/client';
const user = await signUp({
email,
password,
name,
});
it gives the error again.
I changed the code to this, and now it is working
fetch("/api/sanity/signUp", {
body: JSON.stringify({
name: Data.name,
password: Data.password,
email: Data.email
}),
headers: {
"Content-type": "application/json; charset=UTF-8"
}
}).then(response => response.json()).then(json => console.log(json));
the unique difference between your own fetch request and the one made by signUp
is the charset in the Content-Type
.
I added it in the latest version, can you check again?
Getting the same error. The sign-up was working fine before and suddenly started facing this error.
@dhatGuy @Jaydeep189 Can you, guys, double-check that you haven't exported the signUpHandler
under the pages
folder ? I made this mistake by following the example-app here. Feel free to check the PR above.
I am using credential login with my next.js project with sanity
I have copied the schema from the documentation
my pages/api/sanity/signUp.ts code
my signup.tsx code
I was getting this error
So I hardcoded the vales inside my code but the error persists. I don't know what I am doing wrong at this point.