Closed aensley closed 1 year ago
Hi @nevikashah, do you have any ideas about what could be causing my issue?
Same issue here, but with @cloudflare/kv-asset-handler
, but only when using cloudflare/wrangler-action@2.0.0
Although unrelated to https://github.com/cloudflare/wrangler2/labels/pages doing import '@cloudflare/workers-types'
(aka importing worker types locally, rather than globally via tsconfig.json) also triggers this error:
You can mark the path "@cloudflare/workers-types" as external to exclude it from the
bundle, which will remove this error.
X [ERROR] Build failed with 1 error:
src/worker.ts:7:7: ERROR: Could not resolve "@cloudflare/workers-types"
Hi @nevikashah, any updates?
I was having the same issue with @cloudflare/kv-asset-handler
, I have temporarily resolved this by adding a precommand to install @cloudflare/kv-asset-handler
, is there a better approach? Thanks.
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
name: Deploy
steps:
- uses: actions/checkout@v3
- name: Publish
uses: cloudflare/wrangler-action@2.0.0
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
preCommands: npm install @cloudflare/kv-asset-handler@0.2.0
command: publish
Hey there, @aensley - did you ever get this resolved? I followed your reproduction repo and it seems like your Github Actions are running smoothly
@jrf0110 No, this is not resolved. My actions are working on other branches that exclude this package. Every build that references the cloudflare-maintained Sentry package still fails with the error above. I have received no help in resolving this.
I have finally resolved this issue. The problem was that the build command configuration in Cloudflare Pages did not include npm install
. I always thought this was run transparently in the background for NPM sites since I never had to explicitly add it before.
What version of
Wrangler
are you using?2.1.6
What operating system are you using?
Windows (Git Bash/MINGW)
Describe the Bug
Summary
I am unable to resolve any packages in Cloudflare workers despite them being listed on https://workers.cloudflare.com/works and working locally through wrangler.
I followed the official guide to integrate Sentry as middleware.
Repo/branch
https://github.com/aensley/liturgy-day/tree/add-sentry-2
Source
https://github.com/aensley/liturgy-day/blob/12f431856ec80533f29ffa5bc08320ad6dd7d464/functions/_middleware.ts#L1-L8
Build Error
Local output (successful)