React Minified Error #130 on non-index routes using AWS via Flightcontrol

Hi!

I’m working on moving a Redwood v6.6.0 application from Vercel to AWS via Flightcontrol and am running into a React Minified Error #130 only when deployed on non-index, non-errorful routes, e.g:

'/' # Resolves Home page
'/not-a-real-route' # Resolves 404 page
'/private-route' # Resolves private route OR fallback
'/fallback' # Fatal Error -- only works inside a private set
'/about' # Fatal Error
'/sso-callback' # Fatal Error
...

There are no network errors, but on these fatal error pages it looks like the HomePage React element is being loaded (as opposed to the correct page, e.g. AboutPage.js). This only happens when deploying to S3 with Flightcontrol, local rw build && rw serve works as expected.

I believe the 200 SPA redirect is working since I’m not getting the 404, just the wrong page and then a fatal error. It could possibly be something to do with how “MainLayout” is written, but I cannot reproduce this outside of AWS.

I was hoping that I’m missing something obvious that somebody can point out, here’s my Routes, but let know if there is anything else I can provide for debugging.

import { Router, Route, Set, PrivateSet } from '@redwoodjs/router'

import { useAuth } from './auth'
import MainLayout from './layouts/MainLayout/MainLayout'

const Routes = () => {
  return (
    <Router useAuth={useAuth}>
      <Set wrap={MainLayout}>
         {/* This works */}
        <Route path="/" page={HomePage} name="home" prerender />
        
        {/* These do not work */}
        <Route path="/login" page={LoginPage} name="login" />
        <Route path="/users" page={UsersPage} name="users" />
        <Route path="/about" page={AboutPage} name="about" />
        <Route path="/sso-callback" page={SSOCallbackPage} name="ssoCallback" />

        {/* This works */}
        <PrivateSet unauthenticated="login">
          <Route path="/account" page={AccountPage} name="account" />
        </PrivateSet>
      </Set>

      <Route notfound page={NotFoundPage} prerender />
    </Router>
  )
}

export default Routes

Hey @siraj, I didn’t see anything yet, but we deploy every release to flight control using this app:

If you poke around there do you see anything there that looks meaningfully different? Is the flightcontrol.json file more or less the same?

Hey @dom – thanks for following up on this. My flightcontrol.json is almost exactly the same (only difference is that I hard-code the environment variables as the production URLs, but feel free to take a look here : flightcontrol.json · GitHub)

I think this is likely an issue with how my application code interacts with FlightControl.

It’s frustrating that there’s no explicit errors until deployment, but I’ll leave an update here if I make any progress.

I was able to fix this by disabling pre-rendering on the index route.

Seems like this behavior I noticed before is being fulfilled by the server and then corrected on the client/SPA router.

There are no network errors, but on these fatal error pages it looks like the HomePage React element is being loaded (as opposed to the correct page, e.g. AboutPage.js ).