I’m making a Shopify app where the user needs to log into their account to be able to use the app. When the login is successful I want the user to be redirected, but I can’t do it.
The problem I’m having is that when redirecting it sends me to the correct page but displays this screen instead of the page I want. remembering that I am trying to do server-side redirection, without the loader.
It is working in development but in production got this error.
Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.
at Xc (/app/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:77:77)
at Z (/app/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:78:89)
at Xc (/app/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:72:481)
at Z (/app/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:78:89)
at Yc (/app/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:81:98)
at Xc (/app/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:73:145)
at Z (/app/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:78:89)
at Xc (/app/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:72:481)
at Xc (/app/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:76:40)
at Z (/app/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:78:89)
Mmm… That looks like a Remix problem, maybe inside the “/app/rule” loader.
By the way, you don’t need to return the redirect. You can throw it to let Remix know that the loader function will not finish there. I’m not sure if this would fix the problem, but I’d definitely give it a try.
It’s the same issue: I can’t redirect the user to the index route if it isOnboardCompleted. After redirection, the user’s session is lost and automatically redirected to /auth/login.