-
Notifications
You must be signed in to change notification settings - Fork 164
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
Error Installing Wrangler with pnpm #181
Comments
It seems like this could be a result of |
I just ran into this myself. For me I think the special case was that I'm using the - name: Deploy apex-gateway
uses: cloudflare/wrangler-action@v3
with:
accountId: ${{ secrets.CF_ACCOUNT_ID || secrets.CLOUDFLARE_ACCOUNT_ID }}
apiToken: ${{ secrets.CF_API_TOKEN || secrets.CLOUDFLARE_API_TOKEN }}
workingDirectory: 'workers/apex-gateway'
command: 'deploy' My suspicion is that it is looking for
|
Actually I'm now 100% sure that it's a bug because it's searching in the workingDirectory. We can see this in the wrangler-action codebase function detectPackageManager(
workingDirectory = ".",
): PackageManagerValue | null {
if (existsSync(path.join(workingDirectory, "package-lock.json"))) {
return "npm";
}
if (existsSync(path.join(workingDirectory, "yarn.lock"))) {
return "yarn";
}
if (existsSync(path.join(workingDirectory, "pnpm-lock.yaml"))) {
return "pnpm";
}
if (existsSync(path.join(workingDirectory, "bun.lockb"))) {
return "bun";
}
return null;
} This is likely a seperate issue to the one being reported, should I create a new issue report? |
@AdiRishi yes, please open a new issue for that |
Ran into the same error and I am 100% installing pnpm - name: Set up pnpm
uses: pnpm/action-setup@v2
with:
version: 8.6.2
- name: do a bunch of things with pnpm
- name: Deploy
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
accountId: ${{ secrets.CF_ACCOUNT_ID }}
command: pages deploy ./packages/portal/out --project-name=${{ vars.CF_PROJECT_NAME }} |
Here is the actual error (from running locally since you swallow the error :( )
Going to try with a working directory. By the way, I already have it installed at the root, would be great if the action didn't need to do it again... |
Which of course runs into this: #198 This action doesn't work with pnpm workspaces. |
Update: I was able to get by this with a hack
This uses the existing version of wrangler in the root pnpm and injects the |
I was able to work around this issue with a pretty simple change, just by setting - uses: pnpm/action-setup@v2
with:
version: 8.9.0
- uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
workingDirectory: ./<PATH_TO_PACKAGE>/
environment: production
packageManager: pnpm The issue indeed is because of getPackageManager function tries to retrieve P.S: Also, I think it's a good idea to mention this in the docs or troubleshooting, as nowadays many projects use workspaces. |
@thantos thanks for investigating. It looks like there are two distinct problems here:
I'll keep this issue open to track the first problem. |
Another solution to this issue here: #198 (comment) |
This workaround isn't working for me. I have opened a PR with an attempt to fix this: #207 @1000hz let me know if my approach is on the right track. |
Unfortunately, this solution lets the action fail with
|
For the workspace issue, an easy workaround is to just add a step right before wrangler-action:
If you don't have any other pnpm adds later there's no need to remove it in a workflow. |
Since v3.6.0, released a few hours ago, the action will reuse an existing Wrangler installation. Update: the fix that fixed this in v3.6.0 was reverted in v3.6.1 because it had some breaking side effects if you use npm, but it's fine if you use pnpm. We pinned the action to v3.6.0 in our repo to keep the fix: |
Is anyone else here having this issue when setting |
I am still having problem doing, but and what if I am using bun as the package manager? |
Would |
This error started happening in the latest version
The text was updated successfully, but these errors were encountered: