Could not resolve "./supabase.js" from "src/services/apiAuth.js" file: /vercel/path0/src/services/apiAuth.js

I’m getting this while the Vercel project deploying please can anybody help me, This project was build in React Query and supabase database

import supabase, { supabaseUrl } from "./supabase";

export async function signup({ fullName, email, password }) {
  const { data, error } = await supabase.auth.signUp({
    email,
    password,
    options: {
      data: {
        fullName,
        avatar: "",
      },
    },
  });

  if (error) {
    throw new Error(error.message);
  }

  return data;
}

export async function Login({ email, password }) {
  let { data, error } = await supabase.auth.signInWithPassword({
    email,
    password,
  });

  if (error) {
    throw new Error(error.message);
  }

  console.log(data);
  return data;
}

export async function getCurrentUser() {
  const { data: session } = await supabase.auth.getSession();

  if (!session.session) return null;

  const { data, error } = await supabase.auth.getUser();

  // console.log(data);

  if (error) throw new Error(error.message);

  return data?.user;
}

export async function logout() {
  const { error } = await supabase.auth.signOut();

  if (error) throw new Error(error.message);
}

export async function updateCurrentUser({ password, fullName, avatar }) {
  //1. update password or fullname

  let updateData;

  if (password) updateData = { password };
  if (fullName) updateData = { data: { fullName } };

  const { data, error } = await supabase.auth.updateUser(updateData);

  if (error) throw new Error(error.message);
  if (!avatar) return data;

  // 2. upload avatar image

  const fileName = `avatar-${data.user.id}-${Math.random()}`;

  const { error: storageError } = await supabase.storage
    .from("avatars")
    .upload(fileName, avatar);

  if (storageError) throw new Error(storageError.message);

  //3. update the avatar in user

  const { data: updatedUser, error: updateError } =
    await supabase.auth.updateUser({
      data: {
        avatar: `${supabaseUrl}/storage/v1/object/public/avatars/${fileName}`,
      },
    });

  if (updateError) throw new Error(updateError.message);

  return updatedUser;
}

Hi, @uisamratc! Welcome to the Vercel Community :smile:

Does this work locally? Or are you only facing issues when deploying on Vercel?

A few troubleshooting steps that you can try here:

  • Check Supabase configuration

    1. Verify supabase.js file exists in the correct directory
    2. Verify the content of supabase.js is correct
  • Verify Environment Variables

    1. Verify Vercel project settings for environment variables
    2. Verify NEXT_PUBLIC_SUPABASE_URL and NEXT_PUBLIC_SUPABASE_ANON_KEY are set correctly
  • Review Import Statements

    1. Verify import paths are correct in all files using Supabase
    2. Double-check the syntax of import statements
  • Install Dependencies

    1. Verify @supabase/supabase-js is installed
    2. Run npm install or yarn install to update dependencies
  • Check Package.json

    1. Verify all necessary dependencies are listed
    2. Verify Supabase is listed in the dependencies

Let us know how you get on!