Coder Social home page Coder Social logo

Comments (3)

frandiox avatar frandiox commented on June 15, 2024

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.

sid2364 avatar sid2364 commented on June 15, 2024

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.

frandiox avatar frandiox commented on June 15, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.