Redwood: Adding Private route from @redwoodjs/router causes a crash

Created on 22 May 2020  路  2Comments  路  Source: redwoodjs/redwood

When I add a private route to routes.js in my repo, my app crashes with a couple errors.

index.js:1 Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

Check the render method of `Routes`.
    in Routes
    in ApolloProvider (created by GraphQLProvider)
    in GraphQLProvider (created by RedwoodProvider)
    in RedwoodProvider
    in AuthProvider
    in FatalErrorBoundary
console.<computed> @ index.js:1
named-routes.js:27 Uncaught TypeError: Cannot read property 'startsWith' of undefined
    at push.../node_modules/core-js-pure/es/instance/starts-with.js.module.exports (starts-with.js:6)

Most helpful comment

Hey @tonyjmartinez, I'll pull this down and take a look right now, but it looks like your router is still on v0.6.0, along with a few other packages:

  "dependencies": {
    "@redwoodjs/auth": "^0.7.0",
    "@redwoodjs/router": "^0.6.0",
    "@redwoodjs/web": "^0.6.0",
    ...
}

And private routes are a new feature that were introduced at the same time as auth (I think). Maybe upgrading would fix this? This command should do all the heavy-lifting for you:

yarn rw upgrade

All 2 comments

Hey @tonyjmartinez, I'll pull this down and take a look right now, but it looks like your router is still on v0.6.0, along with a few other packages:

  "dependencies": {
    "@redwoodjs/auth": "^0.7.0",
    "@redwoodjs/router": "^0.6.0",
    "@redwoodjs/web": "^0.6.0",
    ...
}

And private routes are a new feature that were introduced at the same time as auth (I think). Maybe upgrading would fix this? This command should do all the heavy-lifting for you:

yarn rw upgrade

That would definitely cause this issue, thanks for debugging @jtoar

Was this page helpful?
0 / 5 - 0 ratings

Related issues

weaversam8 picture weaversam8  路  4Comments

jeliasson picture jeliasson  路  3Comments

Tobbe picture Tobbe  路  4Comments

thedavidprice picture thedavidprice  路  3Comments

CR1AT0RS picture CR1AT0RS  路  4Comments