Astro / React webpage with SSR deploy successful but then 'Page Not Found' 404 error

Hi,

I’ve tried reviewing the forum posts on the topic, and have tried multiple approaches and variations to try make this work.

Using Cursor with Claude 3.7 Sonnet max and have tried it with Gemini 2.5 Pro as well, both LLM’s reviewing each other’s code. Tried it with Bolt.new as well, can’t get it to work.

It seems to be an issue with the netlify astro adaptor and using functions. The code works fine in local dev environment, and appears to deploy succesfully, but then I always get the 404 page not found.

Note this was working fine before I changed the code to be SSR (using Supabase authentication). I’ve triple checked the .env on netlify. Can’t see an issue.

Page not found

Looks like you’ve followed a broken link or entered a URL that doesn’t exist on this site.

If this is your site, and you weren’t expecting a 404 for this path, please visit Netlify’s “page not found” support guide for troubleshooting tips.

Website Address:

(https://portal.flowpath.co.nz/)

Site information

Site name
flowpath-portal-10

Owner
careysenior’s team

Site ID
a50c18d9-d346-4437-be6c-8ff305178a46

Created
Feb 24 at 3:03 PM

Last update
Today at 11:59 AM

1 Lambda function actively running in production.

BUILD LOG
11:58:21 AM: build-image version: 69179d37c92919bcf501ca9a8de95762ede3ffc5 (noble)
11:58:21 AM: buildbot version: 648e870c693a8227febba2139caf43dd78353ae3
11:58:21 AM: Fetching cached dependencies
11:58:21 AM: Starting to download cache of 498.6MB
11:58:22 AM: Finished downloading cache in 1.529s
11:58:22 AM: Starting to extract cache
11:58:31 AM: Finished extracting cache in 8.186s
11:58:31 AM: Finished fetching cache in 9.822s
11:58:31 AM: Starting to prepare the repo for build
11:58:31 AM: Preparing Git Reference refs/heads/main
11:58:33 AM: Starting to install dependencies
11:58:33 AM: Started restoring cached mise cache
11:58:36 AM: Finished restoring cached mise cache
11:58:36 AM: Python version set to 3.13.2
11:58:36 AM: Ruby version set to 2.7.2
11:58:37 AM: Go version set to 1.19
11:58:37 AM: Using PHP version 8.3
11:58:38 AM: Started restoring cached Node.js version
11:58:39 AM: Finished restoring cached Node.js version
11:58:39 AM: v22.14.0 is already installed.
11:58:39 AM: Now using node v22.14.0 (npm v10.9.2)
11:58:39 AM: Enabling Node.js Corepack
11:58:39 AM: Started restoring cached build plugins
11:58:39 AM: Finished restoring cached build plugins
11:58:39 AM: Started restoring cached corepack dependencies
11:58:39 AM: Finished restoring cached corepack dependencies
11:58:39 AM: No npm workspaces detected
11:58:39 AM: Started restoring cached node modules
11:58:39 AM: Finished restoring cached node modules
11:58:39 AM: Installing npm packages using npm version 10.9.2
11:58:41 AM: up to date, audited 473 packages in 1s
11:58:41 AM: 175 packages are looking for funding
11:58:41 AM: run npm fund for details
11:58:41 AM: 4 vulnerabilities (3 moderate, 1 high)
11:58:41 AM: To address issues that do not require attention, run:
11:58:41 AM: npm audit fix
11:58:41 AM: Some issues need review, and may require choosing
11:58:41 AM: a different dependency.
11:58:41 AM: Run npm audit for details.
11:58:41 AM: npm packages installed
11:58:41 AM: Successfully installed dependencies
11:58:41 AM: Starting build script
11:58:42 AM: Detected 1 framework(s)
11:58:42 AM: “astro” at version “5.6.1”
11:58:42 AM: Section completed: initializing
11:58:44 AM: ​
11:58:44 AM: Netlify Build
11:58:44 AM: ────────────────────────────────────────────────────────────────
11:58:44 AM: ​
11:58:44 AM: ❯ Version
11:58:44 AM: @netlify/build 31.0.2
11:58:44 AM: ​
11:58:44 AM: ❯ Flags
11:58:44 AM: accountId: 67b462bce83cebe0db6a9e2e
11:58:44 AM: baseRelDir: true
11:58:44 AM: buildId: 67fc4f8280625d0008141aaf
11:58:44 AM: deployId: 67fc4f8280625d0008141ab1
11:58:44 AM: ​
11:58:44 AM: ❯ Current directory
11:58:44 AM: /opt/build/repo
11:58:44 AM: ​
11:58:44 AM: ❯ Config file
11:58:44 AM: /opt/build/repo/netlify.toml
11:58:44 AM: ​
11:58:44 AM: ❯ Context
11:58:44 AM: production
11:58:44 AM: ​
11:58:44 AM: build.command from netlify.toml
11:58:44 AM: ────────────────────────────────────────────────────────────────
11:58:44 AM: ​
11:58:44 AM: $ npm run build
11:58:44 AM: > Flowpath-Portal-1.0@0.0.1 build
11:58:44 AM: > astro build
11:58:45 AM: 23:58:45 [content] Syncing content
11:58:45 AM: 23:58:45 [content] Synced content
11:58:45 AM: 23:58:45 [types] Generated 33ms
11:58:45 AM: 23:58:45 [build] output: “server”
11:58:45 AM: 23:58:45 [build] mode: “server”
11:58:45 AM: 23:58:45 [build] directory: /opt/build/repo/dist/
11:58:45 AM: 23:58:45 [build] adapter: @astrojs/netlify
11:58:45 AM: 23:58:45 [build] Collecting build info…
11:58:45 AM: 23:58:45 [build] ✓ Completed in 95ms.
11:58:45 AM: 23:58:45 [build] Building server entrypoints…
11:58:46 AM: 23:58:46 [vite] ✓ built in 1.72s
11:58:46 AM: 23:58:46 [build] ✓ Completed in 1.75s.
11:58:46 AM: building client (vite)
11:58:46 AM: 23:58:46 [vite] transforming…
11:58:49 AM: 23:58:49 [vite] ✓ 1562 modules transformed.
11:58:49 AM: 23:58:49 [vite] rendering chunks…
11:58:49 AM: 23:58:49 [vite] computing gzip size…
11:58:49 AM: 23:58:49 [vite] dist/_astro/PrintButton.CgU6NCev.js 0.17 kB │ gzip: 0.15 kB
11:58:49 AM: 23:58:49 [vite] dist/_astro/Header.BB4kkVzI.js 0.23 kB │ gzip: 0.18 kB
11:58:49 AM: 23:58:49 [vite] dist/_astro/calculator.astro_astro_type_script_index_0_lang.BRxgJ_9o.js 0.25 kB │ gzip: 0.20 kB
11:58:49 AM: 23:58:49 [vite] dist/_astro/browser.zqqb17Yq.js 0.35 kB │ gzip: 0.28 kB
11:58:49 AM: 23:58:49 [vite] dist/_astro/supabase.BA0mERuR.js 0.42 kB │ gzip: 0.36 kB
11:58:49 AM: 23:58:49 [vite] dist/_astro/_commonjsHelpers.gnU0ypJ3.js 0.61 kB │ gzip: 0.33 kB
11:58:49 AM: 23:58:49 [vite] dist/_astro/preload-helper.CLcXU_4U.js 0.99 kB │ gzip: 0.60 kB
11:58:49 AM: 23:58:49 [vite] dist/_astro/jsx-runtime.CX9_ZRIA.js 1.00 kB │ gzip: 0.62 kB
11:58:49 AM: 23:58:49 [vite] dist/_astro/PrintButton.Dv441wJ8.js 1.88 kB │ gzip: 0.95 kB
11:58:49 AM: 23:58:49 [vite] dist/_astro/Layout.astro_astro_type_script_index_0_lang.CpJObvV-.js 1.89 kB │ gzip: 0.79 kB
11:58:49 AM: 23:58:49 [vite] dist/_astro/TP108_Chart_Figure5.Qkd0AHlo.js 3.79 kB │ gzip: 1.53 kB
11:58:49 AM: 23:58:49 [vite] dist/_astro/test-detention-save.astro_astro_type_script_index_0_lang.74z4Ls4H.js 4.11 kB │ gzip: 1.83 kB
11:58:49 AM: 23:58:49 [vite] dist/_astro/index.3-1WsM3T.js 6.89 kB │ gzip: 2.78 kB
11:58:49 AM: 23:58:49 [vite] dist/_astro/RainfallCalculator.astro_astro_type_script_index_0_lang.BmPMgUlD.js 7.22 kB │ gzip: 2.81 kB
11:58:49 AM: 23:58:49 [vite] dist/_astro/authStore.QZCG-cA6.js 7.96 kB │ gzip: 3.10 kB
11:58:49 AM: 23:58:49 [vite] dist/_astro/TP108Calculator.astro_astro_type_script_index_0_lang.CxtewsF9.js 10.42 kB │ gzip: 3.24 kB
11:58:49 AM: 23:58:49 [vite] dist/_astro/DetentionCalcSaveLoad.astro_astro_type_script_index_0_lang.BFIIzi-r.js 14.54 kB │ gzip: 3.80 kB
11:58:49 AM: 23:58:49 [vite] dist/_astro/index.BjxPzTmF.js 107.87 kB │ gzip: 29.77 kB
11:58:49 AM: 23:58:49 [vite] dist/_astro/client.BcwTRG3w.js 136.53 kB │ gzip: 44.04 kB
11:58:49 AM: 23:58:49 [vite] dist/_astro/CivilEngineeringPortal.B5rhFxS7.js 371.27 kB │ gzip: 127.02 kB
11:58:49 AM: 23:58:49 [vite] ✓ built in 2.53s
11:58:49 AM: prerendering static routes
11:58:49 AM: 23:58:49 ✓ Completed in 20ms.
11:58:49 AM:
11:58:49 AM: 23:58:49 [build] Rearranging server assets…
11:58:49 AM: 23:58:49 [@astrojs/netlify] Emitted _redirects
11:58:49 AM: 23:58:49 [@astrojs/netlify] Bundling function ../../../build/entry.mjs
11:58:51 AM: 23:58:51 [@astrojs/netlify] Generated SSR Function
11:58:51 AM: 23:58:51 [build] Server built in 6.08s
11:58:51 AM: 23:58:51 [build] Complete!
11:58:51 AM: ​
11:58:51 AM: (build.command completed in 7s)
11:58:51 AM: ​
11:58:51 AM: Functions bundling
11:58:51 AM: ────────────────────────────────────────────────────────────────
11:58:51 AM: ​
11:58:51 AM: The Netlify Functions setting targets a non-existing directory: .netlify/functions
11:58:51 AM: Packaging Functions generated by your framework:
11:58:51 AM: - ssr/ssr.mjs
11:58:51 AM: ​
11:58:51 AM: ​
11:58:51 AM: (Functions bundling completed in 415ms)
11:58:52 AM: ​
11:58:52 AM: Deploy site
11:58:52 AM: ────────────────────────────────────────────────────────────────
11:58:52 AM: ​
11:58:52 AM: Starting to deploy site from ‘dist’
11:58:52 AM: Calculating files to upload
11:58:52 AM: 0 new file(s) to upload
11:58:52 AM: 1 new function(s) to upload
11:58:59 AM: Post processing - header rules
11:58:59 AM: Post processing - Forms
11:58:59 AM: Post processing - redirect rules
11:58:59 AM: Starting post processing
11:58:59 AM: Post processing done
11:58:59 AM: Section completed: postprocessing
11:58:59 AM: Section completed: deploying
11:58:59 AM: Site deploy was successfully initiated
11:58:59 AM: ​
11:58:59 AM: (Deploy site completed in 6.7s)
11:58:59 AM: ​
11:58:59 AM: Netlify Build Complete
11:58:59 AM: ────────────────────────────────────────────────────────────────
11:58:59 AM: ​
11:58:59 AM: (Netlify Build completed in 15s)
11:58:59 AM: Caching artifacts
11:58:59 AM: Started saving node modules
11:58:59 AM: Finished saving node modules
11:58:59 AM: Started saving build plugins
11:58:59 AM: Finished saving build plugins
11:58:59 AM: Started saving mise cache
11:58:59 AM: Finished saving mise cache
11:58:59 AM: Started saving corepack cache
11:58:59 AM: Finished saving corepack cache
11:58:59 AM: Started saving emacs cask dependencies
11:58:59 AM: Finished saving emacs cask dependencies
11:58:59 AM: Started saving maven dependencies
11:58:59 AM: Finished saving maven dependencies
11:58:59 AM: Started saving boot dependencies
11:58:59 AM: Finished saving boot dependencies
11:58:59 AM: Started saving rust rustup cache
11:58:59 AM: Finished saving rust rustup cache
11:58:59 AM: Build script success
11:58:59 AM: Section completed: building
11:59:00 AM: Site is live :sparkles:
11:59:34 AM: Uploading Cache of size 498.6MB
11:59:36 AM: Section completed: cleanup
11:59:36 AM: Finished processing build request in 1m15.021s

Bump… Any help out there?

Should I begin reprogramming in React rather than an Astro/React mix to remove the necessity of the Netlify/Astro adaptor?

hey @careysenior ,

you mentioned:

It seems to be an issue with the netlify astro adaptor and using functions.

Can you clarify whether you’re trying to deploy your own functions or having issues with the lambda that the runtime generates for SSR? The Astro docs have some great instructions for getting this set up, and I’d also recommend using our platform starter as a reference.

It looks like you’ll need to determine why there’s no index.html file being deployed - but if you can make your above repo public or provide a minimal example we can provide further suggestions!

Thanks, that’s very helpful!

I’m looking at rebuilding with the astro-starter that you’ve mentioned, and i checked that code and noticed my website is mixing a few older versions (tailwind, astro/react packages that may be causing errors).

I’ll come back with an update when I find what the issue is more closely related to.

Thanks!

Hi,

I’m really having issues trying to rebuild this on the astro starter - tailwind v3 (my project) compared with v4 in the starter.

I’ve put my project public on github.

Any help or insight would be appreciated.

Cheers

This redirect should not exist: Flowpath-Portal-10/netlify.toml at main · careysenior/Flowpath-Portal-10

1 Like

Thanks @hrishikesh !! That definitely showed the issue and now I can open the webpages. This is a great step forward.

The downside is that it removes the functionality (which was clearly the problem) of SSR from Netlify to Supabase to store webpage input parameters and recall them again from a db. This no longer works, although it works fine in local dev.

Removing that redirect rule seems to break the fundamental mechanism that allows my Astro SSR site to work on Netlify. It prevents pages from being rendered and served, which consequently prevents any associated functionality, including my Supabase integration, from working. For an Astro site deployed in SSR mode on Netlify, this rule seems to be required. The serverless function I need to use is entry.mjs.

I think it’s all to do with using some frankenstein mix of Astro and React instead of perhaps Next.js and React, and my lack of programming ability to resolve the challenge. Without the SSR redirect rule: Netlify’s default behavior for a path like /channel-flow would be to look for a file named channel-flow.html (or similar) inside the dist directory. Because I’m using SSR mode, Astro does not generate individual static HTML files for every page during the build. It generates the serverless function (entry.mjs) that renders pages on demand. Without the redirect rule telling Netlify to use that function, Netlify won’t find the static files it’s looking for.