Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Oxygen: Deployment failed, error: Uncaught ReferenceError: window is not defined #2647

Closed
octave opened this issue Nov 18, 2024 · 1 comment

Comments

@octave
Copy link

octave commented Nov 18, 2024

Which package or tool is having this issue?

Oxygen

What version of that package or tool are you using?

2.0.9

What version of Remix are you using?

2.13.1

Steps to Reproduce

When deploying my Hydrogen store @shopify/[email protected] to Oxygen via Github (standard setup) and from the command line as well shopify hydrogen deploy. It currently fails right at the end of the deployment:

Deploying to Oxygen..
Deployment failed, error: Uncaught ReferenceError: window is not defined
  at worker.mjs:5080:5433
  at worker.mjs:5080:17531
╭─ error ──────────────────────────────────────────────────────────────────────╮
│                                                                              │
│  Uncaught ReferenceError: window is not defined                              │
│    at worker.mjs:5080:5433                                                   │
│    at worker.mjs:5080:17531                                                  │
│                                                                              │
│                                                                              │
│  Retrying the deployment may succeed.                                        │
│                                                                              │
│  Next steps                                                                  │
│    • If the issue persists, please check the Shopify status page [1] for     │
│      any known issues.                                                       │
│                                                                              │
╰──────────────────────────────────────────────────────────────────────────────╯
[1] https://status.shopify.com/

My Github workflow file is up-to-date too:

name: Storefront 0000000000
on: [push]

permissions:
  contents: read
  deployments: write

jobs:
  deploy:
    name: Deploy to Oxygen
    timeout-minutes: 30
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Setup node.js
        uses: actions/setup-node@v4
        with:
          node-version: 'lts/*'
          check-latest: true

      - name: Cache node modules
        id: cache-npm
        uses: actions/cache@v4
        env:
          cache-name: cache-node-modules
        with:
          path: ~/.npm
          key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
          restore-keys: |
            ${{ runner.os }}-build-${{ env.cache-name }}-
            ${{ runner.os }}-build-
            ${{ runner.os }}-

      - name: Install dependencies
        run: npm ci

      - name: Build and Publish to Oxygen
        run: npx shopify hydrogen deploy
        env:
          SHOPIFY_HYDROGEN_DEPLOYMENT_TOKEN: ${{ secrets.OXYGEN_DEPLOYMENT_TOKEN_0000000000 }}

Is there a way to have more details/logs on where to look/investigate?

@octave
Copy link
Author

octave commented Nov 19, 2024

I found the issue, it happens when using @segment/[email protected]:

import {AnalyticsBrowser} from '@segment/analytics-next';

I reported it here: segmentio/analytics-next#1194

@octave octave closed this as completed Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant