Skip to content
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

feat: allow for Pages projects to upload sourcemaps #5861

Merged
merged 1 commit into from
Jun 5, 2024

Conversation

zebp
Copy link
Contributor

@zebp zebp commented May 17, 2024

Adds the ability for Pages projects to use the new sourcemap support in Workers to get remapped stacktraces in the dashboard's real-time logs.

Fixes WP-959 WP-960 WP-961.

Author has addressed the following

  • Tests
    • TODO (before merge)
    • Included
    • Not necessary because:
  • E2E Tests CI Job required? (Use "e2e" label or ask maintainer to run separately)
    • I don't know
    • Required / Maybe required
    • Not required because:
  • Changeset (Changeset guidelines)
    • TODO (before merge)
    • Included
    • Not necessary because:
  • Public documentation

@zebp zebp requested review from a team as code owners May 17, 2024 15:26
Copy link

changeset-bot bot commented May 17, 2024

🦋 Changeset detected

Latest commit: 90afda1

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
wrangler Minor
@cloudflare/vitest-pool-workers Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

github-actions bot commented May 17, 2024

A wrangler prerelease is available for testing. You can install this latest build in your project with:

npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/9386500176/npm-package-wrangler-5861

You can reference the automatically updated head of this PR with:

npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/prs/5861/npm-package-wrangler-5861

Or you can use npx with this latest build directly:

npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/9386500176/npm-package-wrangler-5861 dev path/to/script.js
Additional artifacts:
npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/9386500176/npm-package-create-cloudflare-5861 --no-auto-update
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/9386500176/npm-package-cloudflare-kv-asset-handler-5861
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/9386500176/npm-package-miniflare-5861
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/9386500176/npm-package-cloudflare-pages-shared-5861
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/9386500176/npm-package-cloudflare-vitest-pool-workers-5861

Note that these links will no longer work once the GitHub Actions artifact expires.


wrangler@3.59.0 includes the following runtime dependencies:

Package Constraint Resolved
miniflare workspace:* 3.20240524.2
workerd 1.20240524.0 1.20240524.0
workerd --version 1.20240524.0 2024-05-24

Please ensure constraints are pinned, and miniflare/workerd minor versions match.

@zebp zebp force-pushed the zeb/pages-sourcemaps branch 3 times, most recently from 0de4833 to 019d555 Compare May 20, 2024 13:51
@zebp zebp force-pushed the zeb/pages-sourcemaps branch 3 times, most recently from 1f3aad7 to 7adc86c Compare May 23, 2024 15:14
Copy link
Contributor

@penalosa penalosa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pending Frameworks approval. It'd also be great to see an e2e test or similar of this uploading sourcemaps from a framework build process

@dario-piotrowicz
Copy link
Member

Tested with the Remix sample @zebp graciously provided ❤️

I can confirm that the dash realtime logs seem to be picking up the sourcemaps 😄 🥳

By introducing an issue in the _index.tsx file, without sourcemaps (wrangler@latest) I get:

    {
      "stack": "    at functionsWorker-0.4868909124392582.js:46912:17\n    at new Promise (<anonymous>)\n    at loader (functionsWorker-0.4868909124392582.js:46911:9)\n    at Object.callRouteLoader (functionsWorker-0.4868909124392582.js:5981:26)\n    at commonRoute.loader (functionsWorker-0.4868909124392582.js:6083:45)\n    at actualHandler (functionsWorker-0.4868909124392582.js:3822:18)\n    at functionsWorker-0.4868909124392582.js:3834:31\n    at runHandler (functionsWorker-0.4868909124392582.js:3845:13)\n    at callLoaderOrAction (functionsWorker-0.4868909124392582.js:3894:26)\n    at Object.resolve (functionsWorker-0.4868909124392582.js:3793:33)",
      "name": "Error",
      "message": "error from _index.tsx",
      "timestamp": 1717496670342
    }

whilst with sourcemaps (using this PR's prerelease) I get:

   {
      "stack": "    at ../app/routes/_index.tsx:8:13\n    at new Promise (<anonymous>)\n    at loader (../app/routes/_index.tsx:7:5)\n    at loader (../../node_modules/.pnpm/@remix-run+server-runtime@2.9.2_typescript@5.4.5/node_modules/@remix-run/server-runtime/dist/data.js:66:22)\n    at commonRoute.loader (../../node_modules/.pnpm/@remix-run+server-runtime@2.9.2_typescript@5.4.5/node_modules/@remix-run/server-runtime/dist/routes.js:54:39)\n    at handler (../../node_modules/.pnpm/@remix-run+router@1.16.1/node_modules/@remix-run/router/router.ts:4250:14)\n    at ../../node_modules/.pnpm/@remix-run+router@1.16.1/node_modules/@remix-run/router/router.ts:4266:27\n    at runHandler (../../node_modules/.pnpm/@remix-run+router@1.16.1/node_modules/@remix-run/router/router.ts:4271:7)\n    at runHandler (../../node_modules/.pnpm/@remix-run+router@1.16.1/node_modules/@remix-run/router/router.ts:4328:22)\n    at callLoaderOrAction (../../node_modules/.pnpm/@remix-run+router@1.16.1/node_modules/@remix-run/router/router.ts:4179:13)",
      "name": "Error",
      "message": "error from _index.tsx",
      "timestamp": 1717496195315
    }

💪 🚀

@dario-piotrowicz
Copy link
Member

dario-piotrowicz commented Jun 4, 2024

The changes generally look good to me, except the few small points I commented above 👆

But also, as it has been pointed out by @CarmenPopoviciu the docs haven't yet been updated
Screenshot 2024-06-04 at 11 32 02
👀
I don't really know the wrangler's team policy on this is and if this should or not block the PR, I'm leaving this to them 🙂 (@CarmenPopoviciu, @petebacondarwin?)

Regarding the lack of e2es @penalosa mentioned.... yeah that'd also be quite a nice addition but I can see that the deploy function is unit tested... so I guess I am not too too concerned about the lack of an e2e 🤔 (but again I'd really leave this to the wrangler team to decide)

@penalosa
Copy link
Contributor

penalosa commented Jun 4, 2024

@zebp do you have a docs ticket/PR you can link?

@zebp
Copy link
Contributor Author

zebp commented Jun 4, 2024

@zebp do you have a docs ticket/PR you can link?

I've started one but I haven't created the PR yet, I'll have it up in a few hours.

@zebp zebp force-pushed the zeb/pages-sourcemaps branch from 7adc86c to 90afda1 Compare June 5, 2024 15:00
Copy link
Member

@dario-piotrowicz dario-piotrowicz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! thanks a lot for addressing my comments @zebp 🚀

(and thanks for the docs PR ❤️)

@penalosa penalosa merged commit 1cc52f1 into cloudflare:main Jun 5, 2024
19 checks passed
@workers-devprod workers-devprod mentioned this pull request Jun 5, 2024
@ericmatthys
Copy link

Does this help at all with uploading source maps to Sentry for those using @cloudflare/pages-plugin-sentry? That's currently not possible and it makes stacktraces in Sentry more difficult.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants