hydrogen icon indicating copy to clipboard operation
hydrogen copied to clipboard

Failed to parse URL from /account

Open adamndev opened this issue 2 years ago • 2 comments

Hey, I'm getting the following error when trying to redirect to a different page from an API route.

Error processing route: http://localhost:3001/account/login
TypeError: Failed to parse URL from /account
    at new Request (node:internal/deps/undici/undici:4832:19)
    at Object.api [as resource] (/src/routes/account/login.server.tsx:69:10)
    at Module.renderApiRoute (/node_modules/@shopify/hydrogen/dist/esnext/utilities/apiRoutes.js:119:32)
    at processRequest (/node_modules/@shopify/hydrogen/dist/esnext/entry-server.js?v=7edcb33d:184:53)
    at handleRequest (/node_modules/@shopify/hydrogen/dist/esnext/entry-server.js?v=7edcb33d:163:26)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

The example from the docs says that we should just be able to pass a path to redirect to a different page in the app like this:

return new Request('/account');

I tested this with a fresh install using npm init @shopify/hydrogen and returning a redirect from the login api route at the start of the function and I get the same error as my own app.

Am I doing something weird or is this a bug? Thanks

adamndev avatar Nov 05 '22 23:11 adamndev

We detected some changes in packages/*/package.json or packages/*/src, and there are no updates in the .changeset. If the changes are user-facing and should cause a version bump, run npm run changeset add to track your changes and include them in the next release CHANGELOG. If you are making simple updates to examples or documentation, you do not need to add a changeset.

github-actions[bot] avatar Jul 04 '24 23:07 github-actions[bot]

Oxygen deployed a preview of your hl-applied-gift-cards branch. Details:

Storefront Status Preview link Deployment details Last update (UTC)
metaobjects ✅ Successful (Logs) Preview deployment Inspect deployment July 5, 2024 7:47 PM
Skeleton (skeleton.hydrogen.shop) ✅ Successful (Logs) Preview deployment Inspect deployment July 5, 2024 7:47 PM
optimistic-cart-ui ✅ Successful (Logs) Preview deployment Inspect deployment July 5, 2024 7:47 PM
third-party-queries-caching ✅ Successful (Logs) Preview deployment Inspect deployment July 5, 2024 7:47 PM
classic-remix ✅ Successful (Logs) Preview deployment Inspect deployment July 5, 2024 7:47 PM
custom-cart-method ✅ Successful (Logs) Preview deployment Inspect deployment July 5, 2024 7:47 PM

Learn more about Hydrogen's GitHub integration.

shopify[bot] avatar Jul 04 '24 23:07 shopify[bot]