requests to /api/auth/* hanging for 500s before cancelling when calling to prod URL

I've set up NestJS and better-auth according to https://github.com/laakal/nestjs-better-auth-template, and am hosting it on Railway at https://thewebapi-production.up.railway.app Whenever I run authClient.signUp.email(), the request goes through, but gets left on "pending", both in the dev console and when i tested it on Postman. I don't know whether its a CORS issue or something to do with my implementation of better-auth
2 Replies
Josh
JoshOP2w ago
await signUp.email(
{
email: values.email,
password: values.password,
name: values.name,
callbackURL: '/',
}
);
await signUp.email(
{
email: values.email,
password: values.password,
name: values.name,
callbackURL: '/',
}
);
No description
Josh
JoshOP2w ago
Here's the request from my network tab copied as fetch fetch("https://thewebapi-production.up.railway.app/api/auth/sign-up/email", { "headers": { "accept": "/", "accept-language": "en-GB,en;q=0.9,en-US;q=0.8", "content-type": "application/json", "priority": "u=1, i", "sec-ch-ua": ""Microsoft Edge";v="136", "Microsoft Edge WebView2";v="136", "Not.A/Brand";v="99", "Chromium";v="136"", "sec-ch-ua-mobile": "?0", "sec-ch-ua-platform": ""Windows"", "sec-fetch-dest": "empty", "sec-fetch-mode": "cors", "sec-fetch-site": "cross-site", "sec-fetch-storage-access": "active" }, "referrer": "http://localhost:1420/", "referrerPolicy": "strict-origin-when-cross-origin", "body": "{"email":"[email protected]","password":"fewfewfewfewfewfew","name":"johndoe","callbackURL":"/"}", "method": "POST", "mode": "cors", "credentials": "omit" }); the main thing i notice here is "credentials": "omit" which is weird because in my authClient, i have credentials as include
import { customSessionClient } from 'better-auth/client/plugins';
import {
createAuthClient,
} from 'better-auth/react';

import { auth } from './auth';

const authClient = createAuthClient({
baseURL: 'https://thewebapi-production.up.railway.app',
plugins: [
customSessionClient<typeof auth>(),
],
fetchOptions: {
credentials: 'include',
},

});

export const {
signIn,
signOut,
signUp,
useSession,
} = authClient;
import { customSessionClient } from 'better-auth/client/plugins';
import {
createAuthClient,
} from 'better-auth/react';

import { auth } from './auth';

const authClient = createAuthClient({
baseURL: 'https://thewebapi-production.up.railway.app',
plugins: [
customSessionClient<typeof auth>(),
],
fetchOptions: {
credentials: 'include',
},

});

export const {
signIn,
signOut,
signUp,
useSession,
} = authClient;

Did you find this page helpful?