From 20a970cf67bac787f479282d587b725e6a0dc67c Mon Sep 17 00:00:00 2001 From: Francesco Novy Date: Thu, 9 Feb 2023 13:10:19 +0100 Subject: [PATCH 1/6] build: Update `apollo-server` to get rid of yarn resolution (#7109) --- package.json | 3 +- packages/node-integration-tests/package.json | 2 +- yarn.lock | 127 ++++++++++++------- 3 files changed, 84 insertions(+), 48 deletions(-) diff --git a/package.json b/package.json index 41acc28a1c37..40dc91097f47 100644 --- a/package.json +++ b/package.json @@ -109,8 +109,7 @@ "typescript": "3.8.3" }, "resolutions": { - "**/agent-base": "5", - "@types/express-serve-static-core": "4.17.30" + "**/agent-base": "5" }, "version": "0.0.0", "name": "sentry-javascript" diff --git a/packages/node-integration-tests/package.json b/packages/node-integration-tests/package.json index 341ba1fa84be..03e007a0b126 100644 --- a/packages/node-integration-tests/package.json +++ b/packages/node-integration-tests/package.json @@ -25,7 +25,7 @@ "@types/mongodb": "^3.6.20", "@types/mysql": "^2.15.21", "@types/pg": "^8.6.5", - "apollo-server": "^3.6.7", + "apollo-server": "^3.11.1", "axios": "^0.27.2", "cors": "^2.8.5", "express": "^4.17.3", diff --git a/yarn.lock b/yarn.lock index b7d694549c51..8fb259ed02e0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -234,6 +234,25 @@ "@types/node" "^10.1.0" long "^4.0.0" +"@apollo/protobufjs@1.2.6": + version "1.2.6" + resolved "https://registry.yarnpkg.com/@apollo/protobufjs/-/protobufjs-1.2.6.tgz#d601e65211e06ae1432bf5993a1a0105f2862f27" + integrity sha512-Wqo1oSHNUj/jxmsVp4iR3I480p6qdqHikn38lKrFhfzcDJ7lwd7Ck7cHRl4JE81tWNArl77xhnG/OkZhxKBYOw== + dependencies: + "@protobufjs/aspromise" "^1.1.2" + "@protobufjs/base64" "^1.1.2" + "@protobufjs/codegen" "^2.0.4" + "@protobufjs/eventemitter" "^1.1.0" + "@protobufjs/fetch" "^1.1.0" + "@protobufjs/float" "^1.0.2" + "@protobufjs/inquire" "^1.1.0" + "@protobufjs/path" "^1.1.2" + "@protobufjs/pool" "^1.1.0" + "@protobufjs/utf8" "^1.1.0" + "@types/long" "^4.0.0" + "@types/node" "^10.1.0" + long "^4.0.0" + "@apollo/utils.dropunuseddefinitions@^1.1.0": version "1.1.0" resolved "https://registry.yarnpkg.com/@apollo/utils.dropunuseddefinitions/-/utils.dropunuseddefinitions-1.1.0.tgz#02b04006442eaf037f4c4624146b12775d70d929" @@ -3731,26 +3750,25 @@ resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.51.tgz#cfd70924a25a3fd32b218e5e420e6897e1ac4f40" integrity sha512-CuPgU6f3eT/XgKKPqKd/gLZV1Xmvf1a2R5POBOGQa6uv82xpls89HU5zKeVoyR8XzHd1RGNOlQlvUe3CFkjWNQ== -"@types/express-serve-static-core@4.17.28", "@types/express-serve-static-core@4.17.30", "@types/express-serve-static-core@^4.17.18": - version "4.17.30" - resolved "https://registry.yarnpkg.com/@types/express-serve-static-core/-/express-serve-static-core-4.17.30.tgz#0f2f99617fa8f9696170c46152ccf7500b34ac04" - integrity sha512-gstzbTWro2/nFed1WXtf+TtrpwxH7Ggs4RLYTLbeVgIkUQOI3WG/JKjgeOU1zXDvezllupjrf8OPIdvTbIaVOQ== +"@types/express-serve-static-core@4.17.31": + version "4.17.31" + resolved "https://registry.yarnpkg.com/@types/express-serve-static-core/-/express-serve-static-core-4.17.31.tgz#a1139efeab4e7323834bb0226e62ac019f474b2f" + integrity sha512-DxMhY+NAsTwMMFHBTtJFNp5qiHKJ7TeqOo23zVEM9alT1Ml27Q3xcTH0xwxn7Q0BbMcVEJOs/7aQtUWupUQN3Q== dependencies: "@types/node" "*" "@types/qs" "*" "@types/range-parser" "*" -"@types/express@4.17.13": - version "4.17.13" - resolved "https://registry.yarnpkg.com/@types/express/-/express-4.17.13.tgz#a76e2995728999bab51a33fabce1d705a3709034" - integrity sha512-6bSZTPaTIACxn48l50SR+axgrqm6qXFIxrdAKaG6PaJk3+zuUr35hBlgT7vOmJcum+OEaIBLtHV/qloEAFITeA== +"@types/express-serve-static-core@^4.17.18": + version "4.17.30" + resolved "https://registry.yarnpkg.com/@types/express-serve-static-core/-/express-serve-static-core-4.17.30.tgz#0f2f99617fa8f9696170c46152ccf7500b34ac04" + integrity sha512-gstzbTWro2/nFed1WXtf+TtrpwxH7Ggs4RLYTLbeVgIkUQOI3WG/JKjgeOU1zXDvezllupjrf8OPIdvTbIaVOQ== dependencies: - "@types/body-parser" "*" - "@types/express-serve-static-core" "^4.17.18" + "@types/node" "*" "@types/qs" "*" - "@types/serve-static" "*" + "@types/range-parser" "*" -"@types/express@^4.17.14", "@types/express@^4.17.2": +"@types/express@4.17.14", "@types/express@^4.17.14", "@types/express@^4.17.2": version "4.17.14" resolved "https://registry.yarnpkg.com/@types/express/-/express-4.17.14.tgz#143ea0557249bc1b3b54f15db4c81c3d4eb3569c" integrity sha512-TEbt+vaPFQ+xpxFLFssxUDXj5cWCxZJjIcB7Yg0k0GMHGtgtQgpvx/MUQUeAkNbA9AAGrwkAsoeItdTgS7FMyg== @@ -5145,17 +5163,24 @@ apollo-datasource@^3.3.2: "@apollo/utils.keyvaluecache" "^1.0.1" apollo-server-env "^4.2.1" -apollo-reporting-protobuf@^3.3.1, apollo-reporting-protobuf@^3.3.2: +apollo-reporting-protobuf@^3.3.1: version "3.3.2" resolved "https://registry.yarnpkg.com/apollo-reporting-protobuf/-/apollo-reporting-protobuf-3.3.2.tgz#2078c53d3140bc6221c6040c5326623e0c21c8d4" integrity sha512-j1tx9tmkVdsLt1UPzBrvz90PdjAeKW157WxGn+aXlnnGfVjZLIRXX3x5t1NWtXvB7rVaAsLLILLtDHW382TSoQ== dependencies: "@apollo/protobufjs" "1.2.4" -apollo-server-core@^3.6.7: - version "3.10.1" - resolved "https://registry.yarnpkg.com/apollo-server-core/-/apollo-server-core-3.10.1.tgz#01f9ffc57c7d15c27bd7f89d65f45522aa3f3c3d" - integrity sha512-UFFziv6h15QbKRZOA6wLyr1Sle9kns3JuQ5DEB7OYe5AIoOJNjZkWXX/tmLFUrSmlnDDryi6Sf5pDzpYmUC/UA== +apollo-reporting-protobuf@^3.3.3: + version "3.3.3" + resolved "https://registry.yarnpkg.com/apollo-reporting-protobuf/-/apollo-reporting-protobuf-3.3.3.tgz#df2b7ff73422cd682af3f1805d32301aefdd9e89" + integrity sha512-L3+DdClhLMaRZWVmMbBcwl4Ic77CnEBPXLW53F7hkYhkaZD88ivbCVB1w/x5gunO6ZHrdzhjq0FHmTsBvPo7aQ== + dependencies: + "@apollo/protobufjs" "1.2.6" + +apollo-server-core@^3.11.1: + version "3.11.1" + resolved "https://registry.yarnpkg.com/apollo-server-core/-/apollo-server-core-3.11.1.tgz#89d83aeaa71a59f760ebfa35bb0cbd31e15474ca" + integrity sha512-t/eCKrRFK1lYZlc5pHD99iG7Np7CEm3SmbDiONA7fckR3EaB/pdsEdIkIwQ5QBBpT5JLp/nwvrZRVwhaWmaRvw== dependencies: "@apollo/utils.keyvaluecache" "^1.0.1" "@apollo/utils.logger" "^1.0.0" @@ -5166,18 +5191,19 @@ apollo-server-core@^3.6.7: "@graphql-tools/schema" "^8.0.0" "@josephg/resolvable" "^1.0.0" apollo-datasource "^3.3.2" - apollo-reporting-protobuf "^3.3.2" + apollo-reporting-protobuf "^3.3.3" apollo-server-env "^4.2.1" apollo-server-errors "^3.3.1" - apollo-server-plugin-base "^3.6.2" - apollo-server-types "^3.6.2" + apollo-server-plugin-base "^3.7.1" + apollo-server-types "^3.7.1" async-retry "^1.2.1" fast-json-stable-stringify "^2.1.0" graphql-tag "^2.11.0" loglevel "^1.6.8" lru-cache "^6.0.0" + node-abort-controller "^3.0.1" sha.js "^2.4.11" - uuid "^8.0.0" + uuid "^9.0.0" whatwg-mimetype "^3.0.0" apollo-server-env@^4.2.1: @@ -5192,47 +5218,48 @@ apollo-server-errors@^3.3.1: resolved "https://registry.yarnpkg.com/apollo-server-errors/-/apollo-server-errors-3.3.1.tgz#ba5c00cdaa33d4cbd09779f8cb6f47475d1cd655" integrity sha512-xnZJ5QWs6FixHICXHxUfm+ZWqqxrNuPlQ+kj5m6RtEgIpekOPssH/SD9gf2B4HuWV0QozorrygwZnux8POvyPA== -apollo-server-express@^3.6.7: - version "3.6.7" - resolved "https://registry.yarnpkg.com/apollo-server-express/-/apollo-server-express-3.6.7.tgz#9b83ba088cc40ea98bc0f903f9bfed41ea98fdf8" - integrity sha512-B4gH5j8t3XxTCIa9bl7Iq/F3YFzMxX/LV4Sc+L/3xkHm648u576G5Lkskl8HsoTGSzzyeVcVsPDoYHiBjCAN0Q== +apollo-server-express@^3.11.1: + version "3.11.1" + resolved "https://registry.yarnpkg.com/apollo-server-express/-/apollo-server-express-3.11.1.tgz#f46d2f2f8db3d99ede6c0c144fea02f24b73cb78" + integrity sha512-x9ngcpXbBlt4naCXTwNtBFb/mOd9OU0wtFXvJkObHF26NsRazu3DxDfEuekA6V1NFOocD+A9jmVMQeQWug5MgA== dependencies: "@types/accepts" "^1.3.5" "@types/body-parser" "1.19.2" "@types/cors" "2.8.12" - "@types/express" "4.17.13" - "@types/express-serve-static-core" "4.17.28" + "@types/express" "4.17.14" + "@types/express-serve-static-core" "4.17.31" accepts "^1.3.5" - apollo-server-core "^3.6.7" - apollo-server-types "^3.5.2" + apollo-server-core "^3.11.1" + apollo-server-types "^3.7.1" body-parser "^1.19.0" cors "^2.8.5" parseurl "^1.3.3" -apollo-server-plugin-base@^3.6.2: - version "3.6.2" - resolved "https://registry.yarnpkg.com/apollo-server-plugin-base/-/apollo-server-plugin-base-3.6.2.tgz#f256e1f274c8fee0d7267b6944f402da71788fb3" - integrity sha512-erWXjLOO1u7fxQkbxJ2cwSO7p0tYzNied91I1SJ9tikXZ/2eZUyDyvrpI+4g70kOdEi+AmJ5Fo8ahEXKJ75zdg== +apollo-server-plugin-base@^3.7.1: + version "3.7.1" + resolved "https://registry.yarnpkg.com/apollo-server-plugin-base/-/apollo-server-plugin-base-3.7.1.tgz#aa78ef49bd114e35906ca9cf7493fed2664cbde8" + integrity sha512-g3vJStmQtQvjGI289UkLMfThmOEOddpVgHLHT2bNj0sCD/bbisj4xKbBHETqaURokteqSWyyd4RDTUe0wAUDNQ== dependencies: - apollo-server-types "^3.6.2" + apollo-server-types "^3.7.1" -apollo-server-types@^3.5.2, apollo-server-types@^3.6.2: - version "3.6.2" - resolved "https://registry.yarnpkg.com/apollo-server-types/-/apollo-server-types-3.6.2.tgz#34bb0c335fcce3057cbdf72b3b63da182de6fc84" - integrity sha512-9Z54S7NB+qW1VV+kmiqwU2Q6jxWfX89HlSGCGOo3zrkrperh85LrzABgN9S92+qyeHYd72noMDg2aI039sF3dg== +apollo-server-types@^3.7.1: + version "3.7.1" + resolved "https://registry.yarnpkg.com/apollo-server-types/-/apollo-server-types-3.7.1.tgz#87adfcb52ec0893999a9cfafd5474bfda7ab0798" + integrity sha512-aE9RDVplmkaOj/OduNmGa+0a1B5RIWI0o3zC1zLvBTVWMKTpo0ifVf11TyMkLCY+T7cnZqVqwyShziOyC3FyUw== dependencies: "@apollo/utils.keyvaluecache" "^1.0.1" "@apollo/utils.logger" "^1.0.0" - apollo-reporting-protobuf "^3.3.2" + apollo-reporting-protobuf "^3.3.3" apollo-server-env "^4.2.1" -apollo-server@^3.6.7: - version "3.6.7" - resolved "https://registry.yarnpkg.com/apollo-server/-/apollo-server-3.6.7.tgz#6779de1dfd33afce08dff905e561f628d71ad83d" - integrity sha512-WERZqaVCkZJMoOc9y692NribgNtKbHDjOwiAmgXI2WBlON2oUvCwgxPvsMg+bXVpQx4itrMyj31a2N6BeKmbmQ== +apollo-server@^3.11.1: + version "3.11.1" + resolved "https://registry.yarnpkg.com/apollo-server/-/apollo-server-3.11.1.tgz#831646081323aadf2cb53cdc3401786e41d44d81" + integrity sha512-3RZ/veWGbi0zXy2YVaPkYIAavpbHyEVui91DNYvz6UFS0fZmhJwG7f1VmGheeRiqiV8nFa8GuBejI1niTeAYzA== dependencies: - apollo-server-core "^3.6.7" - apollo-server-express "^3.6.7" + "@types/express" "4.17.14" + apollo-server-core "^3.11.1" + apollo-server-express "^3.11.1" express "^4.17.1" app-module-path@^2.2.0: @@ -17437,6 +17464,11 @@ nock@^13.0.4, nock@^13.0.5, nock@^13.1.0: lodash.set "^4.3.2" propagate "^2.0.0" +node-abort-controller@^3.0.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/node-abort-controller/-/node-abort-controller-3.1.1.tgz#a94377e964a9a37ac3976d848cb5c765833b8548" + integrity sha512-AGK2yQKIjRuqnc6VkX2Xj5d+QW8xZ87pa1UK6yA6ouUyuxfHuMP6umE5QK7UmTeOAymo+Zx1Fxiuw9rVx8taHQ== + node-addon-api@^3.2.1: version "3.2.1" resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-3.2.1.tgz#81325e0a2117789c0128dab65e7e38f07ceba161" @@ -24094,6 +24126,11 @@ uuid@^3.0.0, uuid@^3.3.2, uuid@^3.4.0: resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee" integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A== +uuid@^9.0.0: + version "9.0.0" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-9.0.0.tgz#592f550650024a38ceb0c562f2f6aa435761efb5" + integrity sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg== + v8-compile-cache-lib@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz#6336e8d71965cb3d35a1bbb7868445a7c05264bf" From e9c799bcaf283e2532468e2caadb5ed8b2ae47f5 Mon Sep 17 00:00:00 2001 From: Francesco Novy Date: Thu, 9 Feb 2023 15:19:32 +0100 Subject: [PATCH 2/6] ci: Streamline Gitflow release process (#7113) --- .github/workflows/auto-release.yml | 38 ++++++++++++++ .github/workflows/build.yml | 3 +- .github/workflows/gitflow-sync-master.yml | 62 ----------------------- docs/publishing-a-release.md | 16 +++--- 4 files changed, 48 insertions(+), 71 deletions(-) create mode 100644 .github/workflows/auto-release.yml delete mode 100644 .github/workflows/gitflow-sync-master.yml diff --git a/.github/workflows/auto-release.yml b/.github/workflows/auto-release.yml new file mode 100644 index 000000000000..21556dc2e5a1 --- /dev/null +++ b/.github/workflows/auto-release.yml @@ -0,0 +1,38 @@ +name: Gitflow - Auto prepare release +on: + pull_request: + types: + - closed + branches: + - master + +# This workflow tirggers a release when merging a branch with the pattern `prepare-release/VERSION` into master. +jobs: + release: + runs-on: ubuntu-20.04 + name: 'Prepare a new version' + + steps: + - uses: actions/checkout@v3 + with: + token: ${{ secrets.GH_RELEASE_PAT }} + fetch-depth: 0 + + # https://github.com/actions-ecosystem/action-regex-match + - uses: actions-ecosystem/action-regex-match@v2 + id: version + with: + # Parse version from head branch + text: ${{ github.head_ref }} + # match: refs/heads/preprare-release/xx.xx.xx + regex: '^refs\/heads\/preprare-release\/(\d+\.\d+\.\d+)$' + + - name: Prepare release + uses: getsentry/action-prepare-release@v1 + if: github.event.pull_request.merged == true && steps.version.outputs.match != '' + env: + GITHUB_TOKEN: ${{ secrets.GH_RELEASE_PAT }} + with: + version: ${{ steps.version.outputs.match != '' }} + force: false + merge_target: master diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 90a9657b0938..d9fb4f556826 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -137,7 +137,8 @@ jobs: # Note: These next three have to be checked as strings ('true'/'false')! is_develop: ${{ github.ref == 'refs/heads/develop' }} is_release: ${{ startsWith(github.ref, 'refs/heads/release/') }} - is_gitflow_sync: ${{ github.head_ref == 'refs/heads/develop' || github.head_ref == 'refs/heads/master' }} + # When merging into master, or from master + is_gitflow_sync: ${{ github.head_ref == 'refs/heads/master' || github.ref == 'refs/heads/master' }} has_gitflow_label: ${{ github.event_name == 'pull_request' && contains(steps.pr-labels.outputs.labels, ' Gitflow ') }} force_skip_cache: diff --git a/.github/workflows/gitflow-sync-master.yml b/.github/workflows/gitflow-sync-master.yml deleted file mode 100644 index 6582bbede98a..000000000000 --- a/.github/workflows/gitflow-sync-master.yml +++ /dev/null @@ -1,62 +0,0 @@ -name: Gitflow - Sync develop into master -on: - pull_request: - types: - - closed - branches: - - develop - -env: - MAIN_BRANCH: master - -jobs: - main: - name: Create PR develop->master - runs-on: ubuntu-20.04 - if: | - github.event.pull_request.merged == true && - startsWith(github.event.pull_request.title, 'meta(changelog):') - permissions: - pull-requests: write - contents: write - steps: - - name: git checkout - uses: actions/checkout@v3 - - # https://github.com/marketplace/actions/github-pull-request-action - - name: Create Pull Request - id: open-pr - uses: repo-sync/pull-request@v2 - with: - destination_branch: ${{ env.MAIN_BRANCH }} - pr_title: '[Gitflow] Merge ${{ github.ref_name }} into ${{ env.MAIN_BRANCH }}' - pr_body: 'Merge ${{ github.ref_name }} branch into ${{ env.MAIN_BRANCH }}' - pr_label: 'Dev: Gitflow' - # This token is scoped to Daniel Griesser - github_token: ${{ secrets.REPO_SCOPED_TOKEN }} - - # https://github.com/marketplace/actions/enable-pull-request-automerge - - name: Enable automerge for PR - if: steps.open-pr.outputs.pr_number != '' - uses: peter-evans/enable-pull-request-automerge@v2 - with: - pull-request-number: ${{ steps.open-pr.outputs.pr_number }} - merge-method: merge - - # https://github.com/marketplace/actions/auto-approve - - name: Auto approve PR - # Always skip this for now, until we got a proper bot setup - if: steps.open-pr.outputs.pr_number != '' - uses: hmarr/auto-approve-action@v3 - with: - pull-request-number: ${{ steps.open-pr.outputs.pr_number }} - review-message: 'Auto approved automated PR' - - skipped: - runs-on: ubuntu-20.04 - if: | - github.event.pull_request.merged == false || - startsWith(github.event.pull_request.title, 'meta(changelog):') == false - steps: - - name: Sync skipped - run: echo "OK" diff --git a/docs/publishing-a-release.md b/docs/publishing-a-release.md index 642fd2e51899..ff94e6165ea8 100644 --- a/docs/publishing-a-release.md +++ b/docs/publishing-a-release.md @@ -6,20 +6,20 @@ _These steps are only relevant to Sentry employees when preparing and publishing **If you want to release a new SDK for the first time, be sure to follow the [New SDK Release Checklist](./new-sdk-release-checklist.md)** 1. Determine what version will be released (we use [semver](https://semver.org)). -2. Update [`CHANGELOG.md`](https://github.com/getsentry/sentry-javascript/edit/master/CHANGELOG.md) to add an entry for the next release number and a list of changes since the last release. (See details below.) - a. Merging the Changelog PR will automatically trigger a sync from `develop` -> `master` -3. Run the [Prepare Release](https://github.com/getsentry/sentry-javascript/actions/workflows/release.yml) workflow. - a. Wait for this until the sync to `master` is completed. -4. A new issue should appear in https://github.com/getsentry/publish/issues. -5. Ask a member of the [@getsentry/releases team](https://github.com/orgs/getsentry/teams/releases/members) to approve the release. +2. Create a branch `prepare-release/VERSION`, eg. `prepare-release/7.37.0`, off develop +3. Update [`CHANGELOG.md`](https://github.com/getsentry/sentry-javascript/edit/master/CHANGELOG.md) to add an entry for the next release number and a list of changes since the last release. (See details below.) +4. Create a PR towards `master` branch +5. When the PR is merged, it will automatically trigger the [Prepare Release](https://github.com/getsentry/sentry-javascript/actions/workflows/release.yml) on master. +6. A new issue should appear in https://github.com/getsentry/publish/issues. +7. Ask a member of the [@getsentry/releases team](https://github.com/orgs/getsentry/teams/releases/members) to approve the release. a. Once the release is completed, a sync from `master` ->` develop` will be automatically triggered ## Updating the Changelog -1. Create a new branch. +1. Create a new branch `prepare-release/VERSION` off of `develop`, e.g. `prepare-release/7.37.1`. 2. Run `yarn changelog` and copy everything 3. Create a new section in the changelog, deciding based on the changes whether it should be a minor bump or a patch release. 4. Paste in the logs you copied earlier. 5. Delete any which aren't user-facing changes. 7. If any of the PRs are from external contributors, include underneath the commits `Work in this release contributed by . Thank you for your contributions!`. If there's only one external PR, don't forget to remove the final `s`. If there are three or more, use an Oxford comma. (It's in the Sentry styleguide!) -8. Commit, push, and open a PR with the title `meta: Update changelog for ` against `develop` branch. +8. Commit, push, and open a PR with the title `meta(changelog): Update changelog for VERSION` against `master` branch. From fc7b716a2a5ec922fc9ced60e3404508d5c17fa8 Mon Sep 17 00:00:00 2001 From: Lukas Stracke Date: Thu, 9 Feb 2023 15:21:04 +0100 Subject: [PATCH 3/6] chore(nextjs): Pin node 18.13.0 in nextjs integration tests (#7118) Something in 18.14.0 causes npm's module resolution to local file paths to fail. Let's pin to 18.13.0 for the time being. --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d9fb4f556826..a5f73684e0ff 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -469,7 +469,7 @@ jobs: strategy: fail-fast: false matrix: - node: [10, 12, 14, 16, 18] + node: [10, 12, 14, 16, '18.13.0'] steps: - name: Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }}) uses: actions/checkout@v3 From 538c3a649a9e9cc542a29068a3bf75c547669ef0 Mon Sep 17 00:00:00 2001 From: Luca Forstner Date: Thu, 9 Feb 2023 16:04:49 +0100 Subject: [PATCH 4/6] feat(nextjs): Improve client stack traces (#7097) --- packages/nextjs/src/client/index.ts | 16 +++++++ .../integration/pages/[id]/errorClick.tsx | 11 +++++ .../test/client/errorClick.test.ts | 44 ++++++++++++++++++- 3 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 packages/nextjs/test/integration/pages/[id]/errorClick.tsx diff --git a/packages/nextjs/src/client/index.ts b/packages/nextjs/src/client/index.ts index 8537c15cb963..c2d512b3ef00 100644 --- a/packages/nextjs/src/client/index.ts +++ b/packages/nextjs/src/client/index.ts @@ -69,6 +69,22 @@ function addClientIntegrations(options: BrowserOptions): void { // Filename wasn't a properly formed URL, so there's nothing we can do } + if (frame.filename && frame.filename.startsWith('app:///_next')) { + // We need to URI-decode the filename because Next.js has wildcard routes like "/users/[id].js" which show up as "/users/%5id%5.js" in Error stacktraces. + // The corresponding sources that Next.js generates have proper brackets so we also need proper brackets in the frame so that source map resolving works. + frame.filename = decodeURI(frame.filename); + } + + if ( + frame.filename && + frame.filename.match( + /^app:\/\/\/_next\/static\/chunks\/(main-|main-app-|polyfills-|webpack-|framework-|framework\.)[0-9a-f]+\.js$/, + ) + ) { + // We don't care about these frames. It's Next.js internal code. + frame.in_app = false; + } + return frame; }, }); diff --git a/packages/nextjs/test/integration/pages/[id]/errorClick.tsx b/packages/nextjs/test/integration/pages/[id]/errorClick.tsx new file mode 100644 index 000000000000..df55a4b32967 --- /dev/null +++ b/packages/nextjs/test/integration/pages/[id]/errorClick.tsx @@ -0,0 +1,11 @@ +const ButtonPage = (): JSX.Element => ( + +); + +export default ButtonPage; diff --git a/packages/nextjs/test/integration/test/client/errorClick.test.ts b/packages/nextjs/test/integration/test/client/errorClick.test.ts index 78baee9dad8a..aa73e54ec4f7 100644 --- a/packages/nextjs/test/integration/test/client/errorClick.test.ts +++ b/packages/nextjs/test/integration/test/client/errorClick.test.ts @@ -5,7 +5,7 @@ import { Event } from '@sentry/types'; test('should capture error triggered on click', async ({ page }) => { await page.goto('/errorClick'); - const [_, events] = await Promise.all([ + const [, events] = await Promise.all([ page.click('button'), getMultipleSentryEnvelopeRequests(page, 1, { envelopeType: 'event' }), ]); @@ -15,3 +15,45 @@ test('should capture error triggered on click', async ({ page }) => { value: 'Sentry Frontend Error', }); }); + +test('should have a non-url-encoded top frame in route with parameter', async ({ page }) => { + await page.goto('/some-param/errorClick'); + + const [, events] = await Promise.all([ + page.click('button'), + getMultipleSentryEnvelopeRequests(page, 1, { envelopeType: 'event' }), + ]); + + const frames = events[0]?.exception?.values?.[0].stacktrace?.frames; + + expect(frames?.[frames.length - 1].filename).toMatch(/\/\[id\]\/errorClick-[a-f0-9]+\.js$/); +}); + +test('should mark nextjs internal frames as `in_app`: false', async ({ page }) => { + await page.goto('/some-param/errorClick'); + + const [, events] = await Promise.all([ + page.click('button'), + getMultipleSentryEnvelopeRequests(page, 1, { envelopeType: 'event' }), + ]); + + const frames = events[0]?.exception?.values?.[0].stacktrace?.frames; + + expect(frames).toContainEqual( + expect.objectContaining({ + filename: expect.stringMatching( + /^app:\/\/\/_next\/static\/chunks\/(main-|main-app-|polyfills-|webpack-|framework-|framework\.)[0-9a-f]+\.js$/, + ), + in_app: false, + }), + ); + + expect(frames).not.toContainEqual( + expect.objectContaining({ + filename: expect.stringMatching( + /^app:\/\/\/_next\/static\/chunks\/(main-|main-app-|polyfills-|webpack-|framework-|framework\.)[0-9a-f]+\.js$/, + ), + in_app: true, + }), + ); +}); From a9bf858a830965c6f739e7cb87365d3c93bda453 Mon Sep 17 00:00:00 2001 From: Lukas Stracke Date: Thu, 9 Feb 2023 16:11:02 +0100 Subject: [PATCH 5/6] fix(replay): Export Replay from Sentry namespace in full CDN bundle (#7119) To be consistent with export namespaces, we want the `Replay` integration to be accessible under `Sentry.Replay` in the full CDN bundles. This is backward compatible as we still permit `Sentry.Integrations.Replay` as well. We can remove it in v8. --- CHANGELOG.md | 1 + packages/tracing/src/index.bundle.replay.ts | 7 ++++++- packages/tracing/test/index.bundle.replay.test.ts | 3 ++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a55ffeb1979..53e8740a6cbe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ - feat(replay): Send client_report when replay sending fails (#7093) - fix(node): `LocalVariables`, Improve frame matching for ESM (#7049) - fix(node): Add lru cache to http integration span map (#7064) +- fix(replay): Export Replay from Sentry namespace in full CDN bundle (#7119) Work in this release contributed by @JamesHenry. Thank you for your contribution! diff --git a/packages/tracing/src/index.bundle.replay.ts b/packages/tracing/src/index.bundle.replay.ts index b70b443ef682..403cc6342b65 100644 --- a/packages/tracing/src/index.bundle.replay.ts +++ b/packages/tracing/src/index.bundle.replay.ts @@ -2,6 +2,11 @@ import { Replay } from '@sentry/browser'; import * as Sentry from './index.bundle'; +// TODO (v8): Remove this as it was only needed for backwards compatibility +// We want replay to be available under Sentry.Replay, to be consistent +// with the NPM package version. Sentry.Integrations.Replay = Replay; -export default Sentry; +export { Replay }; + +export * from './index.bundle'; diff --git a/packages/tracing/test/index.bundle.replay.test.ts b/packages/tracing/test/index.bundle.replay.test.ts index 7a55d4c6741e..6de5a19d1f61 100644 --- a/packages/tracing/test/index.bundle.replay.test.ts +++ b/packages/tracing/test/index.bundle.replay.test.ts @@ -1,4 +1,4 @@ -import Sentry from '../src/index.bundle.replay'; +import * as Sentry from '../src/index.bundle.replay'; // Because of the way how we re-export stuff for the replay bundle, we only have a single default export const { Integrations } = Sentry; @@ -15,5 +15,6 @@ describe('Integrations export', () => { }); expect(Integrations.Replay).toBeDefined(); + expect(Sentry.Replay).toBeDefined(); }); }); From c0a227fad18c36fcd0dd7c4cb8597dc9771608a4 Mon Sep 17 00:00:00 2001 From: Lukas Stracke Date: Thu, 9 Feb 2023 16:11:27 +0100 Subject: [PATCH 6/6] meta: Update CHANGELOG for 7.37.0 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 53e8740a6cbe..5493fdffbd62 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ - feat: Add source map debug ids (#7068) - feat(browser): Add IndexedDb offline transport store (#6983) - feat(nextjs): Add auto-wrapping for server components (#6953) +- feat(nextjs): Improve client stack traces (#7097) - feat(replay): Improve rrweb error ignoring (#7087 & #7094) - feat(replay): Send client_report when replay sending fails (#7093) - fix(node): `LocalVariables`, Improve frame matching for ESM (#7049)