Comments (3)
at async runPreview (@shopify/cli-hydrogen/dist/commands/hydrogen/preview.js:69)
Given the stack, it seems you're running the preview command instead of dev?
Try running the dev or preview commands with the --verbose
flag, it should show you more Miniflare logs that might help find the issue.
--
Also, for upgrading we recommend the command h2 upgrade
, it should choose the dependency version appropriately.
from hydrogen.
Thanks a lot @frandiox for taking a look! Yes, sorry I'd mixed up the preview and dev commands, I get the error is the same for both though.
With the --verbose
flag I get the below in my local. This seems to be coming from the js-sha256
module, but I'm not sure it's linked to my .env
, as it's the same error in my local but also via Oxygen deployment when I push to the branch.
workerd/server/server.c++:3189: info: Inspector is listening
service core:user:hydrogen: Uncaught ReferenceError: global is not defined
at index.js:28153:27
at index.js:28245:7 in node_modules/js-sha256/src/sha256.js
at index.js:10:50
at index.js:39859:32
MiniflareCoreError [ERR_RUNTIME_FAILURE]: The Workers runtime failed to start. There is likely additional logging output above.
at #assembleAndUpdateConfig (/Users/siddharthsahay/Work/Git/shopify-hydrogen-demo/node_modules/miniflare/dist/src/index.js:8868:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Mutex.runWith (/Users/siddharthsahay/Work/Git/shopify-hydrogen-demo/node_modules/miniflare/dist/src/index.js:3420:16)
at async #waitForReady (/Users/siddharthsahay/Work/Git/shopify-hydrogen-demo/node_modules/miniflare/dist/src/index.js:8925:5)
at async startWorkerdServer (file:///Users/siddharthsahay/Work/Git/shopify-hydrogen-demo/node_modules/@shopify/cli-hydrogen/dist/lib/mini-oxygen/workerd.js:89:39)
at async safeStartMiniOxygen (file:///Users/siddharthsahay/Work/Git/shopify-hydrogen-demo/node_modules/@shopify/cli-hydrogen/dist/commands/hydrogen/dev.js:172:18)
at async onBuildFinish (file:///Users/siddharthsahay/Work/Git/shopify-hydrogen-demo/node_modules/@shopify/cli-hydrogen/dist/commands/hydrogen/dev.js:255:13)
About the h2 upgrade
command, could you please point me to some docs around this? Would you mean the H2 db in this case? Just want to make sure I set it up right.
from hydrogen.
About the h2 upgrade command, could you please point me to some docs around this? Would you mean the H2 db in this case? Just want to make sure I set it up right.
I mean the CLI command, shopify hydrogen upgrade
or h2 upgrade
if you have the shortcut installed. Docs: https://shopify.dev/docs/api/shopify-cli/hydrogen/hydrogen-upgrade
This command ensures you get valid versions of each package when updating.
With the --verbose flag I get the below in my local. This seems to be coming from the js-sha256 module, but I'm not sure it's linked to my .env, as it's the same error in my local but also via Oxygen deployment when I push to the branch.
I don't think this has to do anything with .env
. One of your dependencies is probably accessing global.something
and that breaks in workers environments because global
is a Node.js-only API. The standard would be globalThis.something
.
You could try polyfilling it with something like globalThis.global = globalThis
or similar but you need to ensure it runs before the dependency accesses it.
That said, I see in your repo that you are bumping Hydrogen and Remix many versions without changing the app code. A lot of things have been updated that need changes in-app. You can see this in the changelogs of each package or, if you use h2 upgrade
command, a markdown file will be generated with the required changes to your code.
However, it might be simpler for you to start from scratch with a new Hydrogen template and apply your changes, if it's not a lot. You can start again with npm create @shopify/hydrogen@latest
with the skeleton template, or add --template demo-store
to get Hydrogen's demo store.
from hydrogen.
Related Issues (20)
- Unable to connect to connect my store. HOT 4
- import causes a require is not defined HOT 8
- React version mismatch when creating new projects HOT 38
- Upgrading to latest Hydrogen version and CLI breaks build and codegen HOT 2
- New Project Store Hydrogen with ERROR Cannot read properties of null (reading 'useState') HOT 6
- Error on locahost:3000 Hydrogen Storefronts "npm run dev" HOT 4
- getStorefrontApiUrl() is missing https protocol HOT 2
- Customizing CSP `frame-ancestors` still includes `'none'` HOT 3
- Invalid value for cartId HOT 1
- Quickstart dev fails with EPIPE error HOT 14
- Redeploying environment through Shopify fails to load SVGs HOT 3
- @shopify/hydrogen@latest vite version doesn't run due to ts-node error HOT 2
- Trailing slash redirects are not working as expected according to shopify docs HOT 3
- Analytics: product_added_to_cart event not recorded for some storefronts HOT 7
- Could not find ts-node, SyntaxError: Unexpected token HOT 3
- im having these issues while setting up local development on windows PC. HOT 6
- CommonJS dependency incompatibility: `ReferenceError: require is not defined` HOT 2
- Client network socket disconnected before secure TLS connection was established HOT 1
- VariantSelector return isAvailable true for missed variants HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hydrogen.