Comments (13)
@thantos thanks for investigating. It looks like there are two distinct problems here:
- The missing
-w
flag in the install command causes pnpm to error - Package manager inference fails when workspaces are used (#198)
I'll keep this issue open to track the first problem.
Installation error stdout being swallowed should be addressed by #171.
I'll also open a new issue to track installing wrangler only when it's not already installed. (#199)
from wrangler-action.
I just ran into this myself. For me I think the special case was that I'm using the workingDirectory
property
- 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 pnpm-lock.yaml
which doesn't exist when running in the subdirectory.
To be clear, this is running in a monorepo setup (using turborepo).
The exact error message is
Run cloudflare/[email protected]
with:
accountId: ***
apiToken: ***
workingDirectory: workers/apex-gateway
command: deploy
quiet: false
env:
TURBO_TOKEN: ***
TURBO_REMOTE_CACHE_SIGNATURE_KEY: ***
TURBO_TEAM: team_tiptop
TURBO_API: ***
GITHUB_SHA: ***
CLOUDFLARE_ACCOUNT_ID: ***
CLOUDFLARE_API_TOKEN: ***
NODE_ENV: production
PNPM_HOME: /home/runner/setup-pnpm/node_modules/.bin
π₯ Installing Wrangler
Running command: npm i [email protected]
npm ERR! code EUNSUPPORTEDPROTOCOL
Error: Command failed: npm i [email protected]
npm ERR! code EUNSUPPORTEDPROTOCOL
npm ERR! Unsupported URL Type "workspace:": workspace:*
npm ERR! A complete log of this run can be found in: /home/runner/.npm/_logs/2023-10-14T09_39_26_137Z-debug-0.log
npm ERR! Unsupported URL Type "workspace:": workspace:*
npm ERR! A complete log of this run can be found in: /home/runner/.npm/_logs/2023-10-14T09_39_26_137Z-debug-0.log
Error: π¨ Action failed
from wrangler-action.
@AdiRishi yes, please open a new issue for that
from wrangler-action.
@AdiRishi yes, please open a new issue for that
Done - #198
from wrangler-action.
I was able to work around this issue with a pretty simple change, just by setting packageManager: pnpm
near the workingDirectory
property:
- 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 packageManager
from detectPackageManager(workingDirectory), and when workingDirectory
is a subdirectory of workspace (e.g. without pnpm-lock.yaml
) - it results in an error. So explicitly setting packageManager: pnpm
- solves this issue.
P.S: Also, I think it's a good idea to mention this in the docs or troubleshooting, as nowadays many projects use workspaces.
from wrangler-action.
Update: I was able to get by this with a hack
wranglerVersion: "* -w"
This uses the existing version of wrangler in the root pnpm and injects the
-w
needed to bypass the PNPM workspace root error.
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.
from wrangler-action.
It seems like this could be a result of pnpm
not being available in the runner environment. Are you including https://github.com/pnpm/action-setup in an earlier step of your workflow before wrangler-action
?
from wrangler-action.
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?
from wrangler-action.
It seems like this could be a result of
pnpm
not being available in the runner environment. Are you including https://github.com/pnpm/action-setup in an earlier step of your workflow beforewrangler-action
?
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 }}
from wrangler-action.
Here is the actual error (from running locally since you swallow the error :( )
ERR_PNPM_ADDING_TO_ROOTβ Running this command will add the dependency to the workspace root, which might not be what you want - if you really meant it, make it explicit by running this command again with the -w flag (or --workspace-root). If you don't want to see this warning anymore, you may set the ignore-workspace-root-check setting to true.
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...
from wrangler-action.
Which of course runs into this: #198
This action doesn't work with pnpm workspaces.
from wrangler-action.
Update: I was able to get by this with a hack
wranglerVersion: "* -w"
This uses the existing version of wrangler in the root pnpm and injects the -w
needed to bypass the PNPM workspace root error.
from wrangler-action.
Another solution to this issue here: #198 (comment)
from wrangler-action.
Related Issues (20)
- test
- Wrangler 3.16 breaking secret uploads HOT 17
- Commands piped to Wrangler doesn't work in GitHub Actions HOT 4
- Add outputs to action HOT 2
- action doesn't use bulk secret upload when specifying wranglerVersion 3.10.0 or higher
- [maintenance] E2E tests aren't running on Version Packages PR
- D1 migrations in CI fail silently HOT 3
- Error: Unable to Locate Executable File: bun in wrangler-action@v3
- confusion re usage HOT 1
- Error: missing entry point HOT 3
- Payment approved
- (enhancement): Surface inner exception when uploading secrets fails HOT 3
- You are about to publish a Workers Service that was last published via the Cloudflare Dashboard. HOT 1
- use wrangler version from package.json HOT 2
- Update docs to avoid Node16 deprecation warning
- Document exact CloudFlare permissions required for CLOUDFLARE_API_TOKEN HOT 1
- Getting mime error [''] HOT 8
- Support KV namespaces creating/binding
- Deployment failing due to "Failed to upload secrets" HOT 5
- Can't deploy a worker to routes that are assigned to another worker.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wrangler-action.