Skip to content

Dependencies cannot be installed in version 3.6.0Β #264

Closed

Description

@tomaco-gojiraf

I was deploying normally and suddenly my pipeline started to fail, and it just happened to coincide with the release of the new action version (3.6.0).
It fails when trying to install the package.json dependencies throwing an error that it cannot resolve the dependency. The error is thrown on the import line of the code and advises you to mark it as external to fix it, but this sounded strange to me because it was already working this way.

✘ [ERROR] Could not resolve "@tsndr/cloudflare-worker-jwt"

src/auth/validate-token.ts:1:23:
1 β”‚ import { verify } from '@tsndr/cloudflare-worker-jwt';
β•΅ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You can mark the path "@tsndr/cloudflare-worker-jwt" as external to exclude it from the bundle, which will remove this error.

The same error happens with zod dependency:

Could not resolve "zod"

Using the action version 3.5.0 fixed the problem quickly.

I also tried using bun as a package manager thinking it might be a npm problem, but it didn't fix anything.

GitHub Action:

name: Deploy Production

on:
  push:
    branches:
      - main

jobs:
  deploy:
    runs-on: ubuntu-latest
    name: Deploy
    environment: production
    steps:
      - uses: actions/checkout@v4

      - name: Deploy
        uses: cloudflare/wrangler-action
        with:
          apiToken: ${{ secrets.CF_API_TOKEN }}
          accountId: ${{ secrets.CF_ACCOUNT_ID }}
          wranglerVersion: 3.57.1
          secrets: |
            SECRET_KEY
        env:
          SECRET_KEY: ${{ secrets.SECRET_KEY }}

Activity

  1. edgeboy47 commented on May 23, 2024

    @edgeboy47

    +1

  2. Maximo-Guk commented on May 23, 2024

    @Maximo-Guk
    Member

    Hey @tomaco-gojiraf and @edgeboy47 πŸ‘‹!

    I can't reproduce dependency installation issues using the new action version 3.6.0 on my repository.

    From the logs you linked it looks to me like it may be a package installation issue, I would double check that zod and @tsndr/cloudflare-worker-jwt are both in your package.json and that's you've ran npm install.

    Would it be possible for one you to provide me with a reproduction repository that has this issue?

    Thank you! πŸ™

  3. svrnhdl commented on May 23, 2024

    @svrnhdl

    Same issue here. Had an old worker on wrangler version 3.23.0 that I updated to 3.57.1 with wrangler-action@v3. Weird thing was that Github Actions was still using 3.23.0 for a while and then suddenly stopped working when it installed 3.57.1.

    downgrading to action version 3.5.0 fixed it.
    image

  4. kchro3 commented on May 23, 2024

    @kchro3

    +1 that i'm seeing this issue too with multiple packages:

    
        ...: ERROR: Could not resolve "@tsndr/cloudflare-worker-jwt"
        ...: ERROR: Could not resolve "hono/streaming"
        ...: ERROR: Could not resolve "openai"
        ...: ERROR: Could not resolve "@anthropic-ai/sdk"
        ...: ERROR: Could not resolve "postgres"
    

    I would double check that zod and @tsndr/cloudflare-worker-jwt are both in your package.json and that's you've ran npm install

    it was working fine a couple days ago, so pretty sure it's not a package issue / npm install issue.

    Also can confirm that downgrading to v3.5.0 works:

    jobs:
      deploy:
        runs-on: ubuntu-latest
        timeout-minutes: 60
        steps:
          - uses: actions/checkout@v4
          - name: Build & Deploy Worker
            uses: cloudflare/wrangler-action@v3.5.0
            with:
              apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
              accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
    
  5. AdiRishi commented on May 24, 2024

    @AdiRishi
    Contributor

    A reproduction repository would be very helpful πŸ™
    I just upgraded three different repos I have to 3.6.0 and it's worked everywhere.

    Also, some context on what wrangler-action was doing when it failed would be good. Here are some of the steps that run.

    πŸ” Checking for existing Wrangler installation
    πŸ“₯ Installing Wrangler (only run if installation is necessary)
    πŸ”‘ Uploading secrets...
    πŸš€ Running Wrangler Commands
    

    Some questions

    • Was it trying to install wrangler?
    • If it was trying to install wrangler, is it using the correct package maanger?
    • Do you expect it to install wrangler? The new change in 3.6.0 will use your local wrangler version if it's present.
  6. sakettawde commented on May 24, 2024

    @sakettawde

    Adding context since am facing a similar issue.

    Absolutely nothing changed in my code. It started failing today.

    Issue seen:
    image

    Changed my github workflow file by specifying to use v3.5 for wrangler-action as below:
    image

    And now it runs as before. Screengrab of logs below:
    image

  7. hiendaovinh commented on May 24, 2024

    @hiendaovinh

    I've the same issue. Pinning to v3.5.0 helps for now.

  8. AdiRishi commented on May 24, 2024

    @AdiRishi
    Contributor

    Oh, I see what happened. Thanks for the screenshots @sakettawde .
    In 3.6.0 we released a new feature which would check for an existing wrangler installation, and use it if appropriate.

    The code which checks for an existing installation runs npx wrangler --version to determine if wrangler is installed. What I missed was that this command will automatically install the latest version of wrangler if no version is installed πŸ™ƒ

    This means that by accident wrangler-action now always will install the latest wrangler if you don't specify wranglerVersion in the config. This is a breaking change and bug, since we meant for it to keep it's old behavior and install version 3.13.2 by default.

    For everyone who's build is now failing, I suspect your codebase has something about it which requires that older version of wrangler, since wrangler deploy fails for you when using version 3.57.1. In order to restore previous behavior, simply pin wranglerVersion to 3.13.2 like this

    jobs:
      deploy:
        steps:
          uses: cloudflare/wrangler-action@v3
          with:
            apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
            wranglerVersion: "3.13.2"

    I'll work on making a PR to fix this issue.

  9. Rohan487 commented on May 24, 2024

    @Rohan487

    image

    +1

  10. self-assigned this
    on May 24, 2024
  11. Maximo-Guk commented on May 24, 2024

    @Maximo-Guk
    Member

    Hello πŸ‘‹

    We ended up reverting #235 in v3.6.1 to prevent breaking changes for users on old versions of wrangler who inadvertently were now using the latest version of wrangler due to not having it specified.

    We will look into fixing this in a follow up because it would be fantastic if we could check for an existing wrangler installation, and install it correctly.

    Let us know if you're still experiencing these issues after upgrading to v3.6.1

    Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions