Deploying an SSR powered Gatsby app via the Netlify CLI breaks SSR pages

Hello everybody,

I’m having issues with Gatsby SSR when I manually deploy the artifact to Netlify.
It seems that Netlify is not generating the __ssr function when I deploy manually via the CLI.
Steps I’ve taken:

  • Installing the @netlify/plugin-gatsby via the TOML
  • Installing the gatsby-plugin-netlify
  • Adding command and publish to the netlify.toml
  • Running the cli in a workflow via deploy --prod

The deployment happens and I can visit the site, but all the SSR pages are not available and redirect to the 404 page.

With automatic deployments (Git Bridge) it worked, but I need to get it running via cli deployments.

Do you have any ideas what I’m doing wrong?


I found a solution! :tada:

For anyone who has a similar problem and comes across this issue via Google. My main problem was that I built the app using gatsby build and not the netlfiy cli and the build command netlify build. After the modification, all the related functions (like __ssr) were generated. These were located in the .netlify folder. So when deploying the build now I had to deploy the public/ folder and also the functions under .netlify/functions and it worked!

thanks for coming back and sharing your solution with the community! this is really helpful. (: