#Getting 504: FUNCTION_INVOCATION_TIMEOUT error on page with getServerSideProps()

30 messages · Page 1 of 1 (latest)

bronze sparrow
#

I'm trying to add a page with the bare minimum structure with getServerSideProps(). This page works locally but when deployed to Vercel I get the FUNCTION_INVOCATION_TIMEOUT error. I have another page that doesn't have a getServerSideProps() and it renders just fine both locally and in prod. Could this be a Vercel thing or something with Next?

My code is literally just the following:

import * as React from "react";
import {Container} from "@mui/material";

export default function About() {
  return <Container maxWidth="lg"></Container>;
}
export async function getServerSideProps(context: any) {

  return {
    // Passed to the page component as props
    props: {},
  };
}

Any ideas?

gray basin
#

Hey!

#

@bronze sparrow

#

I know exactly what's going on here :) we just encountered this

#

Replace import {Container} from "@mui/material"; with import Container from "@mui/material/container";

#

Let me know if it helps, please

bronze sparrow
#

i literally just saw an article that suggests the same thing! I’ll give this a go and will let you know 👍🏻

gray basin
#

Awesome.

bronze sparrow
#

damn it didn't work @gray basin 😦 this is so weird

bronze sparrow
#

would it be worth changing all of my mui imports to default imports?

gusty sparrow
#

What do the logs say?

bronze sparrow
gusty sparrow
#

that's strange thinkingcat
if you run next build locally, does that page take a while to load? If you remove the MUI import does that improve anything?

#

my only other thought is maybe something weird with the container component not having anything inside it

bronze sparrow
#

very strange indeed, ive ran next build locally and the page load just fine and pretty quick too.

#

I’ve tried removing the MUI import, tried returning a test prop from getServerSideProps and still erroring 🤷‍♂️

#

I do have a dynamic directory that’s structured like:

[regions]

  • index.tsx
    [organisations]
    • index.tsx

Where both index.tsx files have getStaticPaths and getStaticProps set up. Could this be interfering with the getServerSide page? I doubt it but at this point I’m considering anything as a culprit

gusty sparrow
#

is this ../orginisations/index.tsx?

bronze sparrow
#

the page that’s erroring should be /pages/about.tsx

#

as per normal

sly belfry
bronze sparrow
#

nah mate we’re fucked

bronze sparrow
sly belfry
bronze sparrow
#

Fixed. Don’t use tree shaking for any of the MUI components.

gusty sparrow
#

MUI strikes again, I ended up switching because I ran into a lot of weird bundling issues lol

zenith jetty
gray basin
zenith jetty
#

Thank you!