Shopify / hydrogen-v1

React-based framework for building dynamic, Shopify-powered custom storefronts.

Home Page:https://shopify.github.io/hydrogen-v1/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] Oxygen is not defined Error on Deployment

kazuhoishida opened this issue · comments

Describe the bug

I attempted to deploy a Hydrogen project to Oxygen, but it failed with an error stating 'Oxygen is not defined'.
I'm fetching data via the Contentful API (created a custom hook by referring to this documentation), but it seems that those environment variables in Oxygen.env are causing the problem.
Looking into the error logs on Github Actions, the build process appears to be successful (shopify hydrogen build also succeeds in the local environment btw), and the error occurs during uploading deployment process.

If I hard-code those secret tokens in a file, the deployment to Oxygen succeeds.

If I use getOxygenVariable() to get the Contentful environment variables, the function returns null as Oxygen.env is undefined.
As a result, the Github Actions deployment itself succeeds, (but naturally), the site preview is not displayed.

Does anybody have an idea what went wrong?

Screenshots

Screenshot 2023-03-24 at 2 25 04

Additional context

  • @shopify/hydrogen@1.6.5
  • Node version v17.9.1