I'm receiving the following error with certificates when trying to fetch the user from Supabase inside getServerSideProps
with Next.js:
AuthRetryableFetchError: request to https://[redacted].supabase.co/auth/v1/user failed, reason: self signed certificate in certificate chain
at [redacted]/node_modules/@supabase/gotrue-js/dist/main/lib/fetch.js:30:16
This is a simplified version of my code for reference:
export const getServerSideProps = async ({ req, res }) => {
const supabase = createServerSupabaseClient({ req, res });
const { data: { user }, error } = await supabase.auth.getUser();
if (error) console.error(error);
return {
props: {
user,
}
}
};
I've already setup yarn
and npm
to both use the right certificate using yarn config set cafile /path/to/certificate/file
and npm config set cafile /path/to/certificate/file
respectively, but for some reason when Next.js tries to get this from the server side (Node.js) it fails, and I'm not sure what service I need to setup to tell it where the certificate is set?
There are a lot of similar questions out there, but I couldn't find any specifically about Next.js or hitting this issue in Node.js.
Any help appreciated.