-
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
[Bug] Wrangler-action cannot detect alternative package managers when using a non-root workingDirectory #198
Comments
Just wanted to add some further detail. @enfipy you mentioned in the other issue that using I just tried this, however from what I can tell this doesn't fix the problem. - name: Deploy apex-gateway
uses: cloudflare/wrangler-action@v3.3.1
with:
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
workingDirectory: 'workers/apex-gateway'
packageManager: 'pnpm'
command: 'deploy' Output
As a side note, I also tried passing
I also want to point out that logging the underlying error would be very helpful, since right now it's a black box. |
@AdiRishi Yes, you are correct. There are actually two issues as Cina Saffary mentioned after my comment. To be honest, I don't really know why exactly you are seeing this issue. Have you tried to put Because in my current setup, all I have is the installed - uses: pnpm/action-setup@v2
with:
version: 8
- uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
workingDirectory: ./apps/api/
environment: staging
packageManager: pnpm That results in this:
|
I'm seeing an additional strange behavior. When passing any value but # Install succeeds
- name: Deploy Cloudflare Worker
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
workingDirectory: packages/backend
wranglerVersion: "3"
packageManager: pnpm
secrets: |
NODE_ENV
DATABASE_URL
env:
NODE_ENV: development
DATABASE_URL: ${{ secrets.DATABASE_URL }}
# Install fails
- name: Deploy Cloudflare Worker
uses: cloudflare/wrangler-action@v3
# Same as above, but...
env:
NODE_ENV: production
DATABASE_URL: ${{ secrets.DATABASE_URL }} Solution is to manage # Install succeeds
- name: Deploy Cloudflare Worker
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
workingDirectory: packages/backend
wranglerVersion: "3"
packageManager: pnpm
environment: production
secrets: |
DATABASE_URL
env:
DATABASE_URL: ${{ secrets.DATABASE_URL }} |
Hey all, I finally got around to trying again today, and @enfipy was correct, the action works when you configure it properly. For anyone else who comes across this, here is the fully working workflow file I used in GitHub. name: Deploy Cloudflare Pages
on:
workflow_run:
workflows: ['CI']
types: [completed]
branches: [main]
jobs:
check:
name: Build and deploy CF Pages
runs-on: ubuntu-latest
if: github.event.workflow_run.conclusion == 'success'
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
with:
version: 8
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'pnpm'
- run: pnpm install
- run: pnpm build
- name: Deploy arishi-website-webapp
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
accountId: ${{ secrets.CF_ACCOUNT_ID }}
command: pages deploy public/ --project-name=adishwar-rishi-website
workingDirectory: 'apps/arishi-website-webapp'
packageManager: 'pnpm'
wranglerVersion: '3.23.0'
|
Versions/tools
wrangler-action@3.3.1
pnpm
Steps to reproduce
wrangler-action
with theworkingDirectory
option set to a sub-folderHere is an example
Expected outcome
wrangler-action
detects that the pnpm package manager us being used in to install packages in the monorepowrangler-action
should default to the locally installed wrangler versionActual outcome
Investigation/explanation
Looking into the codebase we can see that
src/packageManagers.ts
has thedetectPackageManager
function.This function clearly searches for the relevant
*.lock
file within the providedworkingDirectory
This approach won't work in the monorepo / subfolder workingDirectory scenario since the
*.lock
files are typically in the root of the project.The text was updated successfully, but these errors were encountered: