Dedicated to the Hydrogen framework, headless commerce, and building custom storefronts using the Storefront API.
Hi,
We have a headless store setup and trying to deploy it to Oxygen hosting. Current production deployment works well on Azure, but we face these errors when trying to deploy on Oxygen.
We're using Hydrogen v1 without Remix and "isBroswer" function at the moment where the window object is called.
import {isBrowser} from '@shopify/hydrogen';
The error output is the following:
ReferenceError: window is not defined
at new C3 (/Users/andrey/Work/projects/danjohn-hydrogen/dist/worker/index.js:399:55013)
at /Users/andrey/Work/projects/danjohn-hydrogen/dist/worker/index. js: 399:55575 at SourceTextModule.evaluate (node: internal/vm/module: 224:23)
at VMScriptRunner. runAsModule(/Users/andrey/Work/projects/danjohn-hydrogen/node_modules/@miniflare/runner-vm/dist/src/index. js: 293:19) at async iMScriptRunner. run (/Users/andrey/Work/projects/danjohn-hydrogen/node_modules/@miniflare/ runner-vm/dist/src/index.js:314:17) at async EventTarget.#reload (/Users/andrey/Work/proiects/daniohn-hydrogen/ node modules/@miniflare/core/dist/src/index.is:3363:13)
Can anyone help with advice?
Hey @Fourmeta
Are you able to share some demo code which replicates the issue? (Feel free to DM me).
Scott | Developer Advocate @ Shopify
Hey, @SBD_
Sorry, we can't share the source code but looks like the module @miniflare causes this, see the terminal output in the first post.
Hey @Fourmeta
No probs!
Try posting here: https://github.com/Shopify/hydrogen-v1/issues
Or let me know if you can replicate in some simple demo code (don't need to share the entire project).
Scott | Developer Advocate @ Shopify