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

Deploying nextjs app with pnpm causes Webapp warmup timeout #1457

Closed
brianmgray opened this issue Apr 25, 2024 · 4 comments
Closed

Deploying nextjs app with pnpm causes Webapp warmup timeout #1457

brianmgray opened this issue Apr 25, 2024 · 4 comments

Comments

@brianmgray
Copy link

brianmgray commented Apr 25, 2024

Description
I have a Github Actions workflow that has been successfully deploying my nextjs app using npm to Azure Static Webapps for a few weeks. I migrated to pnpm for improved dependency management- it was a few lines of code to change. This builds fine locally, but on Github, the build consistently fails with this message:

Finished Upload. Polling on deployment.
Status: InProgress. Time: 0.0557385(s)
....
Status: InProgress. Time: 574.5292073(s)
Status: Failed. Time: 589.5829263(s)
Deployment Failed :(
Deployment Failure Reason: Web app warm up timed out. Please try again later.

Note: typically before this change this check would take about 20 seconds before I get a valid response from the app and the build completes.

To Reproduce

Here are the key files involved (I can't link directly to source, private repo).

# pr.yml
name: Build and deploy (PR)

on:
  pull_request:
    types: [opened, synchronize, reopened]
    branches:
      - main
  workflow_dispatch:

jobs:
  exec:
    uses: ./.github/workflows/build-and-deploy.yml
    secrets: inherit
    with:
      preview: true
# build-and-deploy.yml
name: Build and deploy
...
jobs:
  build_and_deploy:
    name: Build and Deploy
    runs-on: ubuntu-latest
    ...
    steps:
      ...
      - name: Use pnpm ${{ env.PNPM_VERSION }}
        uses: pnpm/action-setup@v3
        with:
          version: ${{ env.PNPM_VERSION }}
      - name: Use Node.js ${{ env.NODE_VERSION }}
        uses: actions/setup-node@v4
        with:
          node-version: ${{ env.NODE_VERSION }}
      - name: Install
        run: |
          # force a development install, to make sure dev dependencies are installed
          # they get filtered out by the standalone build for next
          NODE_ENV=development pnpm install

      - name: Build
        run: pnpm run build

      - name: Test
        run: pnpm run test

      - name: Deploy
        id: deploy
        if: ${{ !env.ACT || env.DEPLOY == 'true' }}
        uses: Azure/static-web-apps-deploy@v1
        with:
          azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}
          repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
          action: "upload"
          skip_app_build: true
          skip_api_build: true
          app_location: ${{ env.APP_LOCATION }}
        env:
          skip_deploy_on_missing_secrets: true

Expected behavior
Deployment would succeed and I would be able to access the static web app at the preview URL provided by the build.

Screenshots
n/a

Device info (if applicable):
n/a

Additional context
Not sure what else would help, let me know!

@brianmgray brianmgray changed the title Deploying nextjs app with pnpm cache causes Webapp warmup timeout Deploying nextjs app with pnpm causes Webapp warmup timeout Apr 25, 2024
@petero-dk
Copy link

This was a problem for me to, it was based on node_modules not being in the right place or symlinked.

For me it was important to to the following in the .npmrc

shared-workspace-lockfile=false
node-linker=hoisted

which means NO SYMLINKS, but also keep a full node_modules in each project in the shared workspace. If I hoisted the modules to the shared workspace then it would fail with that exact error.

However beware, using this configuration you might run into this problem: pnpm/pnpm#6584

@bbehling
Copy link

bbehling commented May 29, 2024

Same issue here, but intermittent.

@brianmgray
Copy link
Author

Thanks @petero-dk , I will give this a try in the near future.

@brianmgray
Copy link
Author

Yeah @petero-dk , this resolved the issue for me too. Thanks so much!

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

3 participants