Open 1000hz opened 10 months ago
+1 but also wanted to mention that not having the option to disabling this install is preventing my team from using this action because of the hugely increased runtime. The action runs yarn add wrangler
and triggers linking for our entire (large) list of dependencies, and this action takes > 2 minutes. npx wrangler
is ready in < 3 seconds, for comparison.
I've recently moved all my projects to use wrangler-action
in CI. Definitely hit this quite a few times now.
I've made a PR with a fix 👍
@petebacondarwin Please reopen this issue due to #265.
I've recently moved all my projects to use
wrangler-action
in CI. Definitely hit this quite a few times now. I've made a PR with a fix 👍
@AdiRishi Thanks for your contribution. However, I am currently facing some issues with my project setup. My project uses yarn workspaces. Even though I have executed yarn install
which installs wrangler@3.61.0 at the workspace root in bash ./build.sh
, it seems that the check here https://github.com/cloudflare/wrangler-action/blob/main/src/index.ts#L117-L124 did not pass.
// "package.json" in workspace root
{
"name": "sony-pages",
"workspaces": [
"apps/*"
],
"version": "0.0.0",
"private": true,
"scripts": {
"deploy": "wrangler deploy",
"dev": "wrangler dev",
"start": "wrangler dev",
"test": "vitest"
},
"devDependencies": {
"@cloudflare/kv-asset-handler": "^0.3.3",
"@cloudflare/workers-types": "^4.20240620.0",
"lerna": "^8.1.5",
"typescript": "^5.0.4",
"vitest": "1.3.0",
"wrangler": "^3.61.0"
},
"dependencies": {}
}
// the workflow yml
name: Deploy
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
name: Deploy
steps:
- uses: actions/checkout@v4
- name: Build
run: |
bash ./build.sh
- name: Deploy to cloudflare
uses: cloudflare/wrangler-action@v3.6.0
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
- name: Lark bot notify
run: |
curl -X POST \
-H "Content-Type: application/json" \
...
Do you know what could be the reason for this? Below is a screenshot of the results from my workflow execution.
I've recently moved all my projects to use
wrangler-action
in CI. Definitely hit this quite a few times now. I've made a PR with a fix 👍@AdiRishi Thanks for your contribution. However, I am currently facing some issues with my project setup. My project uses yarn workspaces. Even though I have executed
yarn install
which installs wrangler@3.61.0 at the workspace root inbash ./build.sh
, it seems that the check here https://github.com/cloudflare/wrangler-action/blob/main/src/index.ts#L117-L124 did not pass.// "package.json" in workspace root { "name": "sony-pages", "workspaces": [ "apps/*" ], "version": "0.0.0", "private": true, "scripts": { "deploy": "wrangler deploy", "dev": "wrangler dev", "start": "wrangler dev", "test": "vitest" }, "devDependencies": { "@cloudflare/kv-asset-handler": "^0.3.3", "@cloudflare/workers-types": "^4.20240620.0", "lerna": "^8.1.5", "typescript": "^5.0.4", "vitest": "1.3.0", "wrangler": "^3.61.0" }, "dependencies": {} }
// the workflow yml name: Deploy on: push: branches: - main jobs: deploy: runs-on: ubuntu-latest name: Deploy steps: - uses: actions/checkout@v4 - name: Build run: | bash ./build.sh - name: Deploy to cloudflare uses: cloudflare/wrangler-action@v3.6.0 with: apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} - name: Lark bot notify run: | curl -X POST \ -H "Content-Type: application/json" \ ...
Do you know what could be the reason for this? Below is a screenshot of the results from my workflow execution.
Delete 'workspaces' field in package.json is one solution:
name: Deploy
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
name: Deploy
steps:
- uses: actions/checkout@v4
- name: Build
run: |
bash ./build.sh
+ - name: Delete 'workspaces' field
+ run: |
+ jq 'del(.workspaces)' package.json > temp.json
+ mv temp.json package.json
+ cat package.json
- name: Deploy to cloudflare
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
- name: Lark bot notify
run: |
curl -X POST \
-H "Content-Type: application/json" \
.......
Also running into this issue.
@wqcstrong i think you are running into the issue i documented in #277. for now, i just pinned the version in my workflow file (wranglerVersion: 3.64.0
), but hopefully the fix will be merged soon (cc: @tyteen4a03 in case you have the same issue)
Currently,
wrangler-action
always installs wrangler as specified by thewranglerVersion
input or theDEFAULT_WRANGLER_VERSION
constant contained in the source. This isn't always necessary as Wrangler may have already been installed in a previous step of the workflow (e.g. if it's declared in the project's dependencies inpackage.json
). This also makes it harder to keep the version of Wrangler used bywrangler-action
and the version used locally consistent, as the user needs to manually keepwranglerVersion
andpackage.json
in sync.Instead, we should only install Wrangler if it's not already present in the
$PATH
(including the package manager bin directory) OR ifwranglerVersion
has been explicitly provided