ReferenceError: Oxygen is not defined

222 Views Asked by At

I am trying to deploy hydrogen based application using vercel. I have selected Framework Preset as hydrogen while creating project. Error that I am getting is [![enter image description here][1]][1]

And if i check log its saying

[GET] /
14:35:45:13
ReferenceError: Oxygen is not defined
    at worker.js:565:22163
    at worker.js:159:2014
    at worker.js:2388:12955

Any idea how to fix this? [1]: https://i.stack.imgur.com/qZeq0.png

1

There are 1 best solutions below

0
On

For anyone facing same issue. In hydrogen.config.js we are checking for Oxygen env. So removing that will fix this ( if you are deploying on non oxygen env ) After edit it will look like this

import {defineConfig, CookieSessionStorage} from '@shopify/hydrogen/config';

export default defineConfig({
  shopify: {
    defaultCountryCode: 'US',
    defaultLanguageCode: 'EN',
    storeDomain: 'xx.myshopify.com', // || Oxygen?.env?.PUBLIC_STORE_DOMAIN,
    storefrontToken: 'xxx', // Oxygen?.env?.PUBLIC_STOREFRONT_API_TOKEN,
    storefrontApiVersion: '2022-07',
  },
  session: CookieSessionStorage('__session', {
    path: '/',
    httpOnly: true,
    secure: import.meta.env.PROD,
    sameSite: 'Strict',
    maxAge: 60 * 60 * 24 * 30,
  }),
});