Next.js Discord

Discord Forum

Error after upgraded to Next15

Unanswered
Havana posted this in #help-forum
Open in Discord
HavanaOP
Hello, I updated Next.js older version to Next15 and it give me this error in image and its occurring randomly
i updated the code according to the new documentation

I am using SWR for fetching data.

please help me

11 Replies

Did you try deleting the node_modules and .next folders?
HavanaOP
yes
and its occuring randomly
HavanaOP
&752637460550385834
@Havana <@&752637460550385834>
Asian black bear
Don't ping mods for troubleshooting help, only for actual moderation purposes.
HavanaOP
sorry, but its urgent
@Havana and its occuring randomly
I understand the compilation error, but we need more details, my friend. Have you used a nextjs migration codemod? Can you show us the behavior of the functions that do fetch? Do you have any specific configuration in next.config.ts?
HavanaOP
@Southern rough shrimp here is useGetMyProfile

export function useGetMyProfile() {
        return useSWR<ResponseModel<User>>('/api/proxy/Users/GetMyProfile', fetcher, {
        ...dataRefreshSetting1,
        keepPreviousData: true,
    });
}


and the dataRefreshSetting1

export const dataRefreshSetting1 = {
    errorRetryCount: 2, // Retry failed requests twice
    errorRetryInterval: 10 * 1000, // Retry every 5 seconds
    dedupingInterval: 1000 * 60 * 10, // Data stays fresh for 10 seconds
    revalidateOnFocus: false,  // Enable auto-revalidate on focus (optional)
    refreshInterval: 1000 * 60 * 10, // Refresh every 10 mins
    revalidateIfStale: true,  //Enable auto-revalidation when stale (optional)
}
@Losti! I understand the compilation error, but we need more details, my friend. Have you used a nextjs migration codemod? Can you show us the behavior of the functions that do fetch? Do you have any specific configuration in next.config.ts?
HavanaOP
no i don't use the codeMod and here is my next.config
const isProd = process.env.NODE_ENV === 'production';
const BASE_URL_DOMAIN = process.env.BASE_URL_DOMAIN;


const nextConfig = {
  reactStrictMode: true,
  compiler: {
    removeConsole: isProd ? { exclude: ["error"] } : false
  },
  env: {
    API_BASE_URL: process.env.API_BASE_URL || 'https://api.yourdomain.com',
    STORAGE_PASSPHRASE: process.env.STORAGE_PASSPHRASE || 'RandomPassphrase',
    TOKEN: process.env.TOKEN || '',
    PORT: process.env.PORT || 3000,
  },
  images: {
    remotePatterns: [
      {
        protocol: 'https',
        hostname: '**',
        port: '',
        pathname: '**',
      },
    ],
  },
};

export default nextConfig;
HavanaOP
.