Shopify / hydrogen

Hydrogen lets you build faster headless storefronts in less time, on Shopify.
https://hydrogen.shop
MIT License
1.19k stars 241 forks source link

Upgrading to latest Hydrogen version and CLI breaks build and codegen #2041

Closed DennisKraaijeveld closed 2 weeks ago

DennisKraaijeveld commented 3 weeks ago

What is the location of your example repository?

No response

Which package or tool is having this issue?

Hydrogen

What version of that package or tool are you using?

2024.4.1

What version of Remix are you using?

2.8.0

Steps to Reproduce

Run yarn codegen or yarn build

Expected Behavior

Expect it to be running the codegen and build like it was before

Actual Behavior

❯ yarn codegen
yarn run v1.22.21
$ shopify hydrogen codegen
Warning: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app
See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.
Warning: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app
See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.
The above error occurred in the <BoxWithBorder> component:

    at BoxWithBorder (file:///Users/dennis/Developer/Private/viv-sanity-hydrogen/node_modules/@shopify/cli-kit/dist/private/node/ui/components/Banner.js:23:26)
    at Banner (file:///Users/dennis/Developer/Private/viv-sanity-hydrogen/node_modules/@shopify/cli-kit/dist/private/node/ui/components/Banner.js:61:19)
    at FatalError (file:///Users/dennis/Developer/Private/viv-sanity-hydrogen/node_modules/@shopify/cli-kit/dist/private/node/ui/components/FatalError.js:9:23)
    at App (file:///Users/dennis/Developer/Private/viv-sanity-hydrogen/node_modules/@shopify/cli-kit/node_modules/ink/build/components/App.js:19:9)

React will try to recreate this component tree from scratch using the error boundary you provided, InternalApp.

  ERROR  Cannot read properties of null (reading 'useContext')

 node_modules/@shopify/cli-kit/node_modules/react/cjs/react.development.js:1618:21
jamalsoueidan commented 3 weeks ago

https://github.com/Shopify/hydrogen/issues/2040 Same as

graygilmore commented 2 weeks ago

closing in favor of https://github.com/Shopify/hydrogen/issues/2040