question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. Itย collects links to all the places you might be looking at while hunting down a tough bug.

And, if youโ€™re still stuck at the end, weโ€™re happy to hop on a call to see how we can help out.

๐Ÿ› BUG: โœ˜ [ERROR] Could not resolve "@cloudflare/pages-plugin-sentry"

See original GitHub issue

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

09:39:43.463 | Cloning repository...
-- | --
09:39:44.397 | From https://github.com/aensley/liturgy-day
09:39:44.397 | * branch            12f431856ec80533f29ffa5bc08320ad6dd7d464 -> FETCH_HEAD
09:39:44.397 | ย 
09:39:44.443 | HEAD is now at 12f4318 add wrangler?
09:39:44.443 | ย 
09:39:44.551 | ย 
09:39:44.573 | Success: Finished cloning repository files
09:39:45.069 | No build command specified. Skipping build step.
09:39:45.559 | ๐Ÿšง 'wrangler pages <command>' is a beta command. Please report any issues to https://github.com/cloudflare/wrangler2/issues/new/choose
09:39:45.625 | โœ˜ [ERROR] Could not resolve "@cloudflare/pages-plugin-sentry"
09:39:45.625 | ย 
09:39:45.625 | ../../../buildhome/repo/functions/_middleware.ts:1:25:
09:39:45.625 | 1 โ”‚ import sentryPlugin from '@cloudflare/pages-plugin-sentry'
09:39:45.626 | โ•ต                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
09:39:45.626 | ย 
09:39:45.626 | You can mark the path "@cloudflare/pages-plugin-sentry" as external to exclude it from the bundle, which will remove this error.
09:39:45.627 | ย 
09:39:45.630 | 1 error(s) and 0 warning(s) when compiling Worker.
09:39:45.631 | ย 
09:39:45.718 | โœ˜ [ERROR] Build failed with 1 error:
09:39:45.718 | ย 
09:39:45.718 | ../../../buildhome/repo/functions/_middleware.ts:1:25: ERROR: Could not resolve "@cloudflare/pages-plugin-sentry"
09:39:45.718 | ย 
09:39:45.718 | ย 
09:39:45.718 | If you think this is a bug then please create an issue at https://github.com/cloudflare/wrangler2/issues/new/choose
09:39:45.727 | Failed building Pages Functions from /functions.
09:39:46.537 | Failed: an internal error occurred

Local output (successful)

image

me@my-computer MINGW64 ~/Workspaces/liturgy-day (add-sentry-2)
$ npx wrangler pages dev src --binding SENTRY_DSN="https://xxxxxxxxxxxxx@xxxxxxx.ingest.sentry.io/xxxxxxxxx" --binding ENVIRONMENT="local"
๐Ÿšง 'wrangler pages <command>' is a beta command. Please report any issues to https://github.com/cloudflare/wrangler2/issues/new/choose
Compiling worker to "C:\Users\me\AppData\Local\Temp\functionsWorker-0.9120506640895183.js"...
Compiled Worker successfully.
โ–ฒ [WARNING] Passing --inspect is unnecessary, now you can always connect to devtools.

โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ [b] open a browser, [d] open Devtools, [c] clear console, [x] to exit  โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
Debugger listening on ws://0.0.0.0:9229/972d75ea-2273-4625-8023-a5817c6a81ab
For help, see: https://nodejs.org/en/docs/inspector
[pages:wrn] Parsed 2 valid header rules.
[pages:wrn] Service bindings are experimental. There may be breaking changes in the future.
[pages:inf] Worker reloaded! (195.16KiB)
[pages:inf] Listening on 0.0.0.0:8788
[pages:inf] Updated `Request.cf` object cache!
GET /api/day/2022-09-26 200 OK (19.75ms)

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:1
  • Comments:5

github_iconTop GitHub Comments

1reaction
harikrishnan83commented, Nov 23, 2022

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
0reactions
aensleycommented, Nov 9, 2022

Hi @nevikashah, any updates?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Known issues ยท Cloudflare Pages docs
Here are some known bugs and issues with Cloudflare Pages: ... Balancer does not work with *.pages.dev projects; an Error 1000: DNS pointsย ......
Read more >
Sentry Pages Plugin - Cloudflare Docs
The Sentry Pages Plugin captures and logs all exceptions which occur below it in the execution chain of your Pages Functions. It is...
Read more >
Configuring Custom Pages (Error and Challenge)
Learn how to customize Cloudflare's default error and challenge pages to better fit your brand and messaging. Overview Step 1: Create a...
Read more >
Cloudflare Pages error "Failed: an internal error occurred"
I'm using Cloudflare Pages and receiving this generic error during the โ€œDeploying to Cloudflare's global networkโ€ step: Failed: an internal ย ...
Read more >
Pages Plugins - Cloudflare Docs
The full power of Functions is available to Plugins, including middleware, parameterized routes, and static assets. For example, a Pages Plugin ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found