Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deployed to Vercel with 404 Not Found result #33

Open
arbisyarifudin opened this issue Jul 18, 2024 · 10 comments
Open

Deployed to Vercel with 404 Not Found result #33

arbisyarifudin opened this issue Jul 18, 2024 · 10 comments

Comments

@arbisyarifudin
Copy link

arbisyarifudin commented Jul 18, 2024

Hi, I use your template and added some pages and functionality.
But when it is deployed to Vercel, it's always turned 404.

Please feel free to check this.
https://fsc-sd-web2-git-develop-arbis-projects-2fa9c352.vercel.app?_vercel_share=kHsrmA32GvDt0CqRCW35ux0FMt1zTXcG

@arbisyarifudin
Copy link
Author

arbisyarifudin commented Jul 18, 2024

Hi. I think the 404 not found is because i add vercel.json file in there.
So i delete it and run the build again and but the result is:
image
https://fsc-sd-web2-git-main-test-arbis-projects-2fa9c352.vercel.app/?_vercel_share=AnHcaMF8drBKWMPKsTwqUI4uAPwHpIpQ

and the logs is:

TypeError: Cannot read properties of undefined (reading 'getSession')
    at m (/var/task/.next/server/app/(dynamic-pages)/(main-pages)/page.js:1:6628)
    at y (/var/task/.next/server/app/(dynamic-pages)/(main-pages)/page.js:1:6860)
    at eh (/var/task/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:134786)
    at e (/var/task/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:137671)
    at ek (/var/task/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:138145)
    at Array.toJSON (/var/task/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:135755)
    at stringify (<anonymous>)
    at eR (/var/task/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:142219)
    at eE (/var/task/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:142698)
    at Timeout._onTimeout (/var/task/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:135475) {
  digest: '2243357109'
}

@arbisyarifudin
Copy link
Author

the problem is i think from this file: (dynamic-pages)/layout.tsx

import { DynamicLayoutProviders } from './DynamicLayoutProviders';
import { AppSupabaseClient } from '@/types';
import { createSupabaseServerComponentClient } from '@/supabase-clients/createSupabaseServerComponentClient';

// do not cache this layout
export const dynamic = 'force-dynamic';
export const fetchCache = 'only-no-store';
export const revalidate = 0;

async function fetchSession(supabaseClient: AppSupabaseClient) {
  // This is a server-side call, so it will not trigger a revalidation
  const {
    data: { session },
    error,
  } = await supabaseClient.auth.getSession();

  if (error) {
    throw error;
  }

  return session;
}

export const metadata = {
  icons: {
    icon: '/images/logo-black-main.ico',
  },
  title: 'Super Day',
  description: 'Super Day',
};

export default async function RootLayout({
  children,
}: {
  children: React.ReactNode;
}) {
  const supabaseClient = createSupabaseServerComponentClient();
  const [session] = await Promise.all([fetchSession(supabaseClient)]);
  return (
    <DynamicLayoutProviders initialSession={session}>
      {children}
    </DynamicLayoutProviders>
  );
}

@vednig
Copy link

vednig commented Sep 3, 2024

Hey @arbisyarifudin, did you solve the issue I am getting the same problem recently, I have tried lot of things but none seem to be working.

@vednig
Copy link

vednig commented Sep 4, 2024

@imbhargav5 a little help here?

@imbhargav5
Copy link
Owner

imbhargav5 commented Sep 5, 2024 via email

@vednig
Copy link

vednig commented Sep 6, 2024

Any update, are you able to reproduce this?

@imbhargav5
Copy link
Owner

Hi @vednig @arbisyarifudin I have actually been doing a complete rewrite the past few days. Sorry it took a bit longer, but I removed a few outdated patterns and this new code should fare a lot better.

@vednig
Copy link

vednig commented Sep 8, 2024

That's great 🎉 , will you be using @supabase/ssr in it?
And is there any expected timeline for updates?

@vednig
Copy link

vednig commented Sep 8, 2024

I have an app in production, facing this error and I can find a solution to this problem, other than rebuilding it from scratch.

@imbhargav5
Copy link
Owner

imbhargav5 commented Sep 8, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants