diff --git a/.github/ISSUE_TEMPLATE/flaky.yml b/.github/ISSUE_TEMPLATE/flaky.yml index 9cc9046a6ece..bff560770675 100644 --- a/.github/ISSUE_TEMPLATE/flaky.yml +++ b/.github/ISSUE_TEMPLATE/flaky.yml @@ -18,7 +18,7 @@ body: id: job-name attributes: label: Name of Job - placeholder: Build & Test / Nextjs (Node 10) Tests + placeholder: Build & Test / Nextjs (Node 14) Tests description: name of job as reported in the status report validations: required: true diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c258e5066239..d79d61060c95 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -523,7 +523,7 @@ jobs: strategy: fail-fast: false matrix: - node: [8, 10, 12, 14, 16, 18, 20, 21] + node: [14, 16, 18, 20, 21] steps: - name: Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }}) uses: actions/checkout@v4 @@ -540,9 +540,7 @@ jobs: - name: Run tests env: NODE_VERSION: ${{ matrix.node }} - run: | - [[ $NODE_VERSION == 8 ]] && yarn add --dev --ignore-engines --ignore-scripts --ignore-workspace-root-check ts-node@8.10.2 - yarn test-ci-node + run: yarn test-ci-node - name: Compute test coverage uses: codecov/codecov-action@v4 with: @@ -585,7 +583,7 @@ jobs: strategy: fail-fast: false matrix: - node: [10, 12, 14, 16, 18, 20, 21] + node: [14, 16, 18, 20, 21] steps: - name: Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }}) uses: actions/checkout@v4 @@ -874,7 +872,7 @@ jobs: strategy: fail-fast: false matrix: - node: [10, 12, 14, 16, 18, 20, 21] + node: [14, 16, 18, 20, 21] typescript: - false include: diff --git a/dev-packages/node-integration-tests/suites/express/tracing-experimental/test.ts b/dev-packages/node-integration-tests/suites/express/tracing-experimental/test.ts index 526a211033a0..ca3ff93435c8 100644 --- a/dev-packages/node-integration-tests/suites/express/tracing-experimental/test.ts +++ b/dev-packages/node-integration-tests/suites/express/tracing-experimental/test.ts @@ -1,7 +1,6 @@ -import { conditionalTest } from '../../../utils'; import { cleanupChildProcesses, createRunner } from '../../../utils/runner'; -conditionalTest({ min: 14 })('express tracing experimental', () => { +describe('express tracing experimental', () => { afterAll(() => { cleanupChildProcesses(); }); diff --git a/dev-packages/node-integration-tests/suites/tracing-experimental/apollo-graphql/test.ts b/dev-packages/node-integration-tests/suites/tracing-experimental/apollo-graphql/test.ts index 230c4cd4dac3..ad32799a5e79 100644 --- a/dev-packages/node-integration-tests/suites/tracing-experimental/apollo-graphql/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing-experimental/apollo-graphql/test.ts @@ -1,7 +1,6 @@ -import { conditionalTest } from '../../../utils'; import { createRunner } from '../../../utils/runner'; -conditionalTest({ min: 14 })('GraphQL/Apollo Tests', () => { +describe('GraphQL/Apollo Tests', () => { test('CJS - should instrument GraphQL queries used from Apollo Server.', done => { const EXPECTED_TRANSACTION = { transaction: 'Test Transaction', diff --git a/dev-packages/node-integration-tests/suites/tracing-experimental/hapi/test.ts b/dev-packages/node-integration-tests/suites/tracing-experimental/hapi/test.ts index 148bf83bb397..93e3203f6470 100644 --- a/dev-packages/node-integration-tests/suites/tracing-experimental/hapi/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing-experimental/hapi/test.ts @@ -1,9 +1,8 @@ -import { conditionalTest } from '../../../utils'; import { cleanupChildProcesses, createRunner } from '../../../utils/runner'; jest.setTimeout(20000); -conditionalTest({ min: 14 })('hapi auto-instrumentation', () => { +describe('hapi auto-instrumentation', () => { afterAll(async () => { cleanupChildProcesses(); }); diff --git a/dev-packages/node-integration-tests/suites/tracing-experimental/mongodb/test.ts b/dev-packages/node-integration-tests/suites/tracing-experimental/mongodb/test.ts index 83018f4c9a3d..b8c16862c34c 100644 --- a/dev-packages/node-integration-tests/suites/tracing-experimental/mongodb/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing-experimental/mongodb/test.ts @@ -1,11 +1,10 @@ import { MongoMemoryServer } from 'mongodb-memory-server-global'; -import { conditionalTest } from '../../../utils'; import { cleanupChildProcesses, createRunner } from '../../../utils/runner'; jest.setTimeout(20000); -conditionalTest({ min: 14 })('MongoDB experimental Test', () => { +describe('MongoDB experimental Test', () => { let mongoServer: MongoMemoryServer; beforeAll(async () => { diff --git a/dev-packages/node-integration-tests/suites/tracing-experimental/mongoose/test.ts b/dev-packages/node-integration-tests/suites/tracing-experimental/mongoose/test.ts index 1a246d8ec5b9..050a3ffc9e12 100644 --- a/dev-packages/node-integration-tests/suites/tracing-experimental/mongoose/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing-experimental/mongoose/test.ts @@ -1,11 +1,10 @@ import { MongoMemoryServer } from 'mongodb-memory-server-global'; -import { conditionalTest } from '../../../utils'; import { cleanupChildProcesses, createRunner } from '../../../utils/runner'; jest.setTimeout(20000); -conditionalTest({ min: 14 })('Mongoose experimental Test', () => { +describe('Mongoose experimental Test', () => { let mongoServer: MongoMemoryServer; beforeAll(async () => { diff --git a/dev-packages/node-integration-tests/suites/tracing-experimental/mysql/test.ts b/dev-packages/node-integration-tests/suites/tracing-experimental/mysql/test.ts index 84c63a30ff68..530349ae3fb7 100644 --- a/dev-packages/node-integration-tests/suites/tracing-experimental/mysql/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing-experimental/mysql/test.ts @@ -1,7 +1,6 @@ -import { conditionalTest } from '../../../utils'; import { cleanupChildProcesses, createRunner } from '../../../utils/runner'; -conditionalTest({ min: 14 })('mysql auto instrumentation', () => { +describe('mysql auto instrumentation', () => { afterAll(() => { cleanupChildProcesses(); }); diff --git a/dev-packages/node-integration-tests/suites/tracing-experimental/mysql2/test.ts b/dev-packages/node-integration-tests/suites/tracing-experimental/mysql2/test.ts index 28209009b03e..db056fd222e8 100644 --- a/dev-packages/node-integration-tests/suites/tracing-experimental/mysql2/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing-experimental/mysql2/test.ts @@ -1,7 +1,6 @@ -import { conditionalTest } from '../../../utils'; import { cleanupChildProcesses, createRunner } from '../../../utils/runner'; -conditionalTest({ min: 14 })('mysql2 auto instrumentation', () => { +describe('mysql2 auto instrumentation', () => { afterAll(() => { cleanupChildProcesses(); }); diff --git a/dev-packages/node-integration-tests/suites/tracing-experimental/postgres/test.ts b/dev-packages/node-integration-tests/suites/tracing-experimental/postgres/test.ts index 117a5d80ac02..d83f992638d1 100644 --- a/dev-packages/node-integration-tests/suites/tracing-experimental/postgres/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing-experimental/postgres/test.ts @@ -1,7 +1,6 @@ -import { conditionalTest } from '../../../utils'; import { createRunner } from '../../../utils/runner'; -conditionalTest({ min: 14 })('postgres auto instrumentation', () => { +describe('postgres auto instrumentation', () => { test('should auto-instrument `pg` package', done => { const EXPECTED_TRANSACTION = { transaction: 'Test Transaction', diff --git a/dev-packages/node-integration-tests/suites/tracing-new/apollo-graphql/test.ts b/dev-packages/node-integration-tests/suites/tracing-new/apollo-graphql/test.ts index bcddfd588447..bcf16ca1dfb4 100644 --- a/dev-packages/node-integration-tests/suites/tracing-new/apollo-graphql/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing-new/apollo-graphql/test.ts @@ -1,8 +1,6 @@ -import { TestEnv, assertSentryTransaction, conditionalTest } from '../../../utils'; +import { TestEnv, assertSentryTransaction } from '../../../utils'; -// Node 10 is not supported by `graphql-js` -// Ref: https://github.com/graphql/graphql-js/blob/main/package.json -conditionalTest({ min: 12 })('GraphQL/Apollo Tests', () => { +describe('GraphQL/Apollo Tests', () => { test('should instrument GraphQL and Apollo Server.', async () => { const env = await TestEnv.init(__dirname); const envelope = await env.getEnvelopeRequest({ envelopeType: 'transaction' }); diff --git a/dev-packages/node-integration-tests/suites/tracing-new/auto-instrument/mongodb/test.ts b/dev-packages/node-integration-tests/suites/tracing-new/auto-instrument/mongodb/test.ts index d2ce56f314ee..76ae4706eeb0 100644 --- a/dev-packages/node-integration-tests/suites/tracing-new/auto-instrument/mongodb/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing-new/auto-instrument/mongodb/test.ts @@ -1,11 +1,11 @@ import { MongoMemoryServer } from 'mongodb-memory-server-global'; -import { TestEnv, assertSentryTransaction, conditionalTest } from '../../../../utils'; +import { TestEnv, assertSentryTransaction } from '../../../../utils'; // This test can take longer. jest.setTimeout(15000); -conditionalTest({ min: 12 })('MongoDB Test', () => { +describe('MongoDB Test', () => { let mongoServer: MongoMemoryServer; beforeAll(async () => { diff --git a/dev-packages/node-integration-tests/suites/tracing-new/prisma-orm/test.ts b/dev-packages/node-integration-tests/suites/tracing-new/prisma-orm/test.ts index 4a76f328dd34..0d969c262413 100644 --- a/dev-packages/node-integration-tests/suites/tracing-new/prisma-orm/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing-new/prisma-orm/test.ts @@ -1,6 +1,6 @@ -import { TestEnv, assertSentryTransaction, conditionalTest } from '../../../utils'; +import { TestEnv, assertSentryTransaction } from '../../../utils'; -conditionalTest({ min: 12 })('Prisma ORM Integration', () => { +describe('Prisma ORM Integration', () => { test('should instrument Prisma client for tracing.', async () => { const env = await TestEnv.init(__dirname); const envelope = await env.getEnvelopeRequest({ envelopeType: 'transaction' }); diff --git a/dev-packages/node-integration-tests/suites/tracing/apollo-graphql/test.ts b/dev-packages/node-integration-tests/suites/tracing/apollo-graphql/test.ts index bcddfd588447..bcf16ca1dfb4 100644 --- a/dev-packages/node-integration-tests/suites/tracing/apollo-graphql/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/apollo-graphql/test.ts @@ -1,8 +1,6 @@ -import { TestEnv, assertSentryTransaction, conditionalTest } from '../../../utils'; +import { TestEnv, assertSentryTransaction } from '../../../utils'; -// Node 10 is not supported by `graphql-js` -// Ref: https://github.com/graphql/graphql-js/blob/main/package.json -conditionalTest({ min: 12 })('GraphQL/Apollo Tests', () => { +describe('GraphQL/Apollo Tests', () => { test('should instrument GraphQL and Apollo Server.', async () => { const env = await TestEnv.init(__dirname); const envelope = await env.getEnvelopeRequest({ envelopeType: 'transaction' }); diff --git a/dev-packages/node-integration-tests/suites/tracing/auto-instrument/mongodb/test.ts b/dev-packages/node-integration-tests/suites/tracing/auto-instrument/mongodb/test.ts index d2ce56f314ee..76ae4706eeb0 100644 --- a/dev-packages/node-integration-tests/suites/tracing/auto-instrument/mongodb/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/auto-instrument/mongodb/test.ts @@ -1,11 +1,11 @@ import { MongoMemoryServer } from 'mongodb-memory-server-global'; -import { TestEnv, assertSentryTransaction, conditionalTest } from '../../../../utils'; +import { TestEnv, assertSentryTransaction } from '../../../../utils'; // This test can take longer. jest.setTimeout(15000); -conditionalTest({ min: 12 })('MongoDB Test', () => { +describe('MongoDB Test', () => { let mongoServer: MongoMemoryServer; beforeAll(async () => { diff --git a/dev-packages/node-integration-tests/suites/tracing/prisma-orm/test.ts b/dev-packages/node-integration-tests/suites/tracing/prisma-orm/test.ts index 4a76f328dd34..0d969c262413 100644 --- a/dev-packages/node-integration-tests/suites/tracing/prisma-orm/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/prisma-orm/test.ts @@ -1,6 +1,6 @@ -import { TestEnv, assertSentryTransaction, conditionalTest } from '../../../utils'; +import { TestEnv, assertSentryTransaction } from '../../../utils'; -conditionalTest({ min: 12 })('Prisma ORM Integration', () => { +describe('Prisma ORM Integration', () => { test('should instrument Prisma client for tracing.', async () => { const env = await TestEnv.init(__dirname); const envelope = await env.getEnvelopeRequest({ envelopeType: 'transaction' }); diff --git a/packages/angular/package.json b/packages/angular/package.json index d6668d7c2af0..69073a5e1e07 100644 --- a/packages/angular/package.json +++ b/packages/angular/package.json @@ -7,7 +7,7 @@ "author": "Sentry", "license": "MIT", "engines": { - "node": ">=8" + "node": ">=14" }, "main": "build/bundles/sentry-angular.umd.js", "module": "build/fesm2015/sentry-angular.js", diff --git a/packages/browser/package.json b/packages/browser/package.json index db4a7315a346..7dbe81061ad8 100644 --- a/packages/browser/package.json +++ b/packages/browser/package.json @@ -7,7 +7,7 @@ "author": "Sentry", "license": "MIT", "engines": { - "node": ">=8" + "node": ">=14" }, "files": [ "cjs", diff --git a/packages/bun/package.json b/packages/bun/package.json index 74ccdc24611e..bac554fee6dd 100644 --- a/packages/bun/package.json +++ b/packages/bun/package.json @@ -7,7 +7,7 @@ "author": "Sentry", "license": "MIT", "engines": { - "node": ">=8" + "node": ">=14" }, "files": [ "cjs", diff --git a/packages/core/package.json b/packages/core/package.json index 24b1157174e6..3bd1182f7931 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -7,7 +7,7 @@ "author": "Sentry", "license": "MIT", "engines": { - "node": ">=8" + "node": ">=14" }, "files": [ "cjs", diff --git a/packages/eslint-config-sdk/package.json b/packages/eslint-config-sdk/package.json index 0849cfc388b1..74a0159579d3 100644 --- a/packages/eslint-config-sdk/package.json +++ b/packages/eslint-config-sdk/package.json @@ -12,7 +12,7 @@ "sentry" ], "engines": { - "node": ">=8" + "node": ">=14" }, "files": [ "src" diff --git a/packages/eslint-plugin-sdk/package.json b/packages/eslint-plugin-sdk/package.json index e5c16a64c307..ec06cadca350 100644 --- a/packages/eslint-plugin-sdk/package.json +++ b/packages/eslint-plugin-sdk/package.json @@ -12,7 +12,7 @@ "sentry" ], "engines": { - "node": ">=8" + "node": ">=14" }, "files": [ "src" diff --git a/packages/gatsby/package.json b/packages/gatsby/package.json index 4fca577e0bc8..998efebd193d 100644 --- a/packages/gatsby/package.json +++ b/packages/gatsby/package.json @@ -11,7 +11,7 @@ "gatsby-plugin" ], "engines": { - "node": ">=8" + "node": ">=14" }, "files": [ "cjs", diff --git a/packages/hub/package.json b/packages/hub/package.json index b3dcf9f3045f..1d51f3adb0be 100644 --- a/packages/hub/package.json +++ b/packages/hub/package.json @@ -7,7 +7,7 @@ "author": "Sentry", "license": "MIT", "engines": { - "node": ">=8" + "node": ">=14" }, "files": [ "cjs", diff --git a/packages/integrations/package.json b/packages/integrations/package.json index c232487a6e95..b016aaf1d9e8 100644 --- a/packages/integrations/package.json +++ b/packages/integrations/package.json @@ -7,7 +7,7 @@ "author": "Sentry", "license": "MIT", "engines": { - "node": ">=8" + "node": ">=14" }, "publishConfig": { "access": "public" diff --git a/packages/nextjs/package.json b/packages/nextjs/package.json index 59a83f0b80a9..3f6ef36ca15f 100644 --- a/packages/nextjs/package.json +++ b/packages/nextjs/package.json @@ -7,7 +7,7 @@ "author": "Sentry", "license": "MIT", "engines": { - "node": ">=8" + "node": ">=14" }, "main": "build/cjs/index.server.js", "module": "build/esm/index.server.js", diff --git a/packages/nextjs/test/integration/test/server/doubleEndMethodOnVercel.test.ts b/packages/nextjs/test/integration/test/server/doubleEndMethodOnVercel.test.ts index 07b70e61e036..5bc1aed6536e 100644 --- a/packages/nextjs/test/integration/test/server/doubleEndMethodOnVercel.test.ts +++ b/packages/nextjs/test/integration/test/server/doubleEndMethodOnVercel.test.ts @@ -4,10 +4,6 @@ import { NextTestEnv } from './utils/helpers'; // `res.send` multiple times in one request handler. // https://github.com/getsentry/sentry-javascript/issues/6670 it.skip('should not break API routes on Vercel if people call res.json or res.send multiple times in one request handler', async () => { - if (process.env.NODE_MAJOR === '10') { - console.log('not running doubleEndMethodOnVercel test on Node 10'); - return; - } const env = await NextTestEnv.init(); const url = `${env.url}/api/doubleEndMethodOnVercel`; const response = await env.getAPIResponse(url); diff --git a/packages/node/README.md b/packages/node/README.md index cab92a553d25..0fdf96a4aa34 100644 --- a/packages/node/README.md +++ b/packages/node/README.md @@ -18,7 +18,7 @@ ## Usage To use this SDK, call `init(options)` as early as possible in the main entry module. This will initialize the SDK and -hook into the environment. Note that you can turn off almost all side effects using the respective options. +hook into the environment. Note that you can turn off almost all side effects using the respective options. Minimum supported Node version is Node 14. ```javascript // CJS syntax diff --git a/packages/node/package.json b/packages/node/package.json index 6b538d1a2246..28d51122a57c 100644 --- a/packages/node/package.json +++ b/packages/node/package.json @@ -7,7 +7,7 @@ "author": "Sentry", "license": "MIT", "engines": { - "node": ">=8" + "node": ">=14" }, "files": [ "cjs", diff --git a/packages/node/test/async/hooks.test.ts b/packages/node/test/async/hooks.test.ts index f016a7087e4f..513abd2b0ccb 100644 --- a/packages/node/test/async/hooks.test.ts +++ b/packages/node/test/async/hooks.test.ts @@ -10,9 +10,8 @@ import { } from '@sentry/core'; import { setHooksAsyncContextStrategy } from '../../src/async/hooks'; -import { conditionalTest } from '../utils'; -conditionalTest({ min: 12 })('setHooksAsyncContextStrategy()', () => { +describe('setHooksAsyncContextStrategy()', () => { beforeEach(() => { const hub = new Hub(); // eslint-disable-next-line deprecation/deprecation diff --git a/packages/node/test/integrations/http.test.ts b/packages/node/test/integrations/http.test.ts index 0b1d81edd29c..527ef48c3f0f 100644 --- a/packages/node/test/integrations/http.test.ts +++ b/packages/node/test/integrations/http.test.ts @@ -682,17 +682,11 @@ describe('default protocols', () => { it('makes https request over http proxy', async () => { const key = 'catcatchers'; const p = captureBreadcrumb(key); - let nockProtocol = 'https'; const proxy = 'http://some.url:3128'; const agent = new HttpsProxyAgent(proxy); - // TODO (v8): No longer needed once we drop Node 8 support - if (NODE_VERSION.major < 9) { - nockProtocol = 'http'; - } - - nock(`${nockProtocol}://${key}.ingest.sentry.io`).get('/api/123122332/store/').reply(200); + nock(`https://${key}.ingest.sentry.io`).get('/api/123122332/store/').reply(200); https.get({ host: `${key}.ingest.sentry.io`, diff --git a/packages/node/test/integrations/undici.test.ts b/packages/node/test/integrations/undici.test.ts index f280b3d4018a..1decb76006fd 100644 --- a/packages/node/test/integrations/undici.test.ts +++ b/packages/node/test/integrations/undici.test.ts @@ -2,7 +2,7 @@ import * as http from 'http'; import { Transaction, getActiveSpan, getClient, getCurrentScope, setCurrentClient, startSpan } from '@sentry/core'; import { spanToTraceHeader } from '@sentry/core'; import { Hub, makeMain, runWithAsyncContext } from '@sentry/core'; -import type { fetch as FetchType } from 'undici'; +import { fetch } from 'undici'; import { NodeClient } from '../../src/client'; import type { Undici, UndiciOptions } from '../../src/integrations/undici'; @@ -13,17 +13,16 @@ import { conditionalTest } from '../utils'; const SENTRY_DSN = 'https://0@0.ingest.sentry.io/0'; let hub: Hub; -let fetch: typeof FetchType; beforeAll(async () => { try { await setupTestServer(); - // need to conditionally require `undici` because it's not available in Node 10 - // eslint-disable-next-line @typescript-eslint/no-var-requires - fetch = require('undici').fetch; } catch (e) { // eslint-disable-next-line no-console - console.warn('Undici integration tests are skipped because undici is not installed.'); + const error = new Error('Undici integration tests are skipped because test server could not be set up.'); + // This needs lib es2022 and newer so marking as any + (error as any).cause = e; + throw e; } }); diff --git a/packages/node/test/manual/webpack-async-context/npm-build.js b/packages/node/test/manual/webpack-async-context/npm-build.js index 9d9c687981bb..eac357b10f36 100644 --- a/packages/node/test/manual/webpack-async-context/npm-build.js +++ b/packages/node/test/manual/webpack-async-context/npm-build.js @@ -7,11 +7,6 @@ if (Number(process.versions.node.split('.')[0]) >= 18) { process.exit(0); } -// Webpack test does not work in Node 8 and below. -if (Number(process.versions.node.split('.')[0]) <= 8) { - process.exit(0); -} - // biome-ignore format: Follow-up for prettier webpack( { diff --git a/packages/opentelemetry-node/package.json b/packages/opentelemetry-node/package.json index 95e6bc8da8fd..9574933a1c86 100644 --- a/packages/opentelemetry-node/package.json +++ b/packages/opentelemetry-node/package.json @@ -7,7 +7,7 @@ "author": "Sentry", "license": "MIT", "engines": { - "node": ">=8" + "node": ">=14" }, "files": [ "cjs", diff --git a/packages/profiling-node/package.json b/packages/profiling-node/package.json index 8118230deb07..fd999c68b3ba 100644 --- a/packages/profiling-node/package.json +++ b/packages/profiling-node/package.json @@ -19,7 +19,7 @@ "sentry-prune-profiler-binaries": "scripts/prune-profiler-binaries.js" }, "engines": { - "node": ">=8.0.0" + "node": ">=14" }, "publishConfig": { "access": "public" diff --git a/packages/react/package.json b/packages/react/package.json index f4898621fd4a..d43bef08cef7 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -7,7 +7,7 @@ "author": "Sentry", "license": "MIT", "engines": { - "node": ">=8" + "node": ">=14" }, "files": [ "cjs", diff --git a/packages/replay-canvas/README.md b/packages/replay-canvas/README.md index eac14facc5cc..21af46bf2512 100644 --- a/packages/replay-canvas/README.md +++ b/packages/replay-canvas/README.md @@ -8,7 +8,7 @@ ## Pre-requisites -Replay with canvas requires Node 12+, and browsers newer than IE11. +Replay with canvas requires Node 14+, and browsers newer than IE11. ## Installation diff --git a/packages/replay/README.md b/packages/replay/README.md index 091f51d785bf..e87aa7861b94 100644 --- a/packages/replay/README.md +++ b/packages/replay/README.md @@ -12,7 +12,7 @@ ## Pre-requisites -`@sentry/replay` requires Node 12+, and browsers newer than IE11. +`@sentry/replay` requires Node 14+, and browsers newer than IE11. ## Installation diff --git a/packages/svelte/package.json b/packages/svelte/package.json index 6406acf463e5..10c6dac63b7d 100644 --- a/packages/svelte/package.json +++ b/packages/svelte/package.json @@ -7,7 +7,7 @@ "author": "Sentry", "license": "MIT", "engines": { - "node": ">=8" + "node": ">=14" }, "files": [ "cjs", diff --git a/packages/tracing-internal/package.json b/packages/tracing-internal/package.json index 1783c2dc075b..a69ff69f4cbe 100644 --- a/packages/tracing-internal/package.json +++ b/packages/tracing-internal/package.json @@ -7,7 +7,7 @@ "author": "Sentry", "license": "MIT", "engines": { - "node": ">=8" + "node": ">=14" }, "files": [ "cjs", diff --git a/packages/tracing-internal/test/browser/backgroundtab.test.ts b/packages/tracing-internal/test/browser/backgroundtab.test.ts index 27cba1d934fa..38dbc04bae37 100644 --- a/packages/tracing-internal/test/browser/backgroundtab.test.ts +++ b/packages/tracing-internal/test/browser/backgroundtab.test.ts @@ -2,11 +2,11 @@ import { Hub, makeMain, spanToJSON, startSpan } from '@sentry/core'; import { JSDOM } from 'jsdom'; import { addExtensionMethods } from '../../../tracing/src'; -import { conditionalTest, getDefaultBrowserClientOptions } from '../../../tracing/test/testutils'; +import { getDefaultBrowserClientOptions } from '../../../tracing/test/testutils'; import { registerBackgroundTabDetection } from '../../src/browser/backgroundtab'; import { TestClient } from '../utils/TestClient'; -conditionalTest({ min: 10 })('registerBackgroundTabDetection', () => { +describe('registerBackgroundTabDetection', () => { let events: Record = {}; let hub: Hub; beforeEach(() => { diff --git a/packages/tracing-internal/test/browser/browsertracing.test.ts b/packages/tracing-internal/test/browser/browsertracing.test.ts index b9830b8d754c..8144f4b0621b 100644 --- a/packages/tracing-internal/test/browser/browsertracing.test.ts +++ b/packages/tracing-internal/test/browser/browsertracing.test.ts @@ -7,7 +7,7 @@ import { JSDOM } from 'jsdom'; import { timestampInSeconds } from '@sentry/utils'; import type { IdleTransaction } from '../../../tracing/src'; import { getActiveTransaction } from '../../../tracing/src'; -import { conditionalTest, getDefaultBrowserClientOptions } from '../../../tracing/test/testutils'; +import { getDefaultBrowserClientOptions } from '../../../tracing/test/testutils'; import type { BrowserTracingOptions } from '../../src/browser/browsertracing'; import { BrowserTracing, getMetaContent } from '../../src/browser/browsertracing'; import { defaultRequestInstrumentationOptions } from '../../src/browser/request'; @@ -55,7 +55,7 @@ beforeAll(() => { WINDOW.location = dom.window.location; }); -conditionalTest({ min: 10 })('BrowserTracing', () => { +describe('BrowserTracing', () => { let hub: Hub; beforeEach(() => { jest.useFakeTimers(); diff --git a/packages/tracing/package.json b/packages/tracing/package.json index cbcbb217493e..aa8b44ecdc5c 100644 --- a/packages/tracing/package.json +++ b/packages/tracing/package.json @@ -7,7 +7,7 @@ "author": "Sentry", "license": "MIT", "engines": { - "node": ">=8" + "node": ">=14" }, "files": [ "cjs", diff --git a/packages/types/package.json b/packages/types/package.json index bd2250fe145e..0d09fcee6cd5 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -7,7 +7,7 @@ "author": "Sentry", "license": "MIT", "engines": { - "node": ">=8" + "node": ">=14" }, "files": [ "cjs", diff --git a/packages/utils/package.json b/packages/utils/package.json index f3ad380a7c4d..b4ceaf186c6d 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -7,7 +7,7 @@ "author": "Sentry", "license": "MIT", "engines": { - "node": ">=8" + "node": ">=14" }, "files": [ "cjs", diff --git a/packages/utils/src/requestdata.ts b/packages/utils/src/requestdata.ts index aaa1898e1f55..85b748dadaba 100644 --- a/packages/utils/src/requestdata.ts +++ b/packages/utils/src/requestdata.ts @@ -69,7 +69,8 @@ export type TransactionNamingScheme = 'path' | 'methodPath' | 'handler'; export function addRequestDataToTransaction( transaction: Transaction | undefined, req: PolymorphicRequest, - deps?: InjectedNodeDeps, + // TODO(v8): Remove this parameter in v8 + _deps?: InjectedNodeDeps, ): void { if (!transaction) return; // eslint-disable-next-line deprecation/deprecation @@ -87,7 +88,7 @@ export function addRequestDataToTransaction( } // TODO: We need to rewrite this to a flat format? // eslint-disable-next-line deprecation/deprecation - transaction.setData('query', extractQueryParams(req, deps)); + transaction.setData('query', extractQueryParams(req)); } /** @@ -188,10 +189,11 @@ export function extractRequestData( req: PolymorphicRequest, options?: { include?: string[]; + // TODO(v8): Remove this paramater deps?: InjectedNodeDeps; }, ): ExtractedNodeRequestData { - const { include = DEFAULT_REQUEST_INCLUDES, deps } = options || {}; + const { include = DEFAULT_REQUEST_INCLUDES } = options || {}; // eslint-disable-next-line @typescript-eslint/no-explicit-any const requestData: { [key: string]: any } = {}; @@ -257,7 +259,7 @@ export function extractRequestData( // node: req.url (raw) // express, koa, nextjs: req.query // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - requestData.query_string = extractQueryParams(req, deps); + requestData.query_string = extractQueryParams(req); break; } case 'data': { @@ -349,10 +351,7 @@ export function addRequestDataToEvent( return event; } -function extractQueryParams( - req: PolymorphicRequest, - deps?: InjectedNodeDeps, -): string | Record | undefined { +function extractQueryParams(req: PolymorphicRequest): string | Record | undefined { // url (including path and query string): // node, express: req.originalUrl // koa, nextjs: req.url @@ -369,13 +368,8 @@ function extractQueryParams( } try { - return ( - req.query || - (typeof URL !== 'undefined' && new URL(originalUrl).search.slice(1)) || - // In Node 8, `URL` isn't in the global scope, so we have to use the built-in module from Node - (deps && deps.url && deps.url.parse(originalUrl).query) || - undefined - ); + const queryParams = req.query || new URL(originalUrl).search.slice(1); + return queryParams.length ? queryParams : undefined; } catch { return undefined; } diff --git a/packages/utils/src/vendor/escapeStringForRegex.ts b/packages/utils/src/vendor/escapeStringForRegex.ts index 2b55452802ad..229c3da707c1 100644 --- a/packages/utils/src/vendor/escapeStringForRegex.ts +++ b/packages/utils/src/vendor/escapeStringForRegex.ts @@ -1,6 +1,6 @@ // Based on https://github.com/sindresorhus/escape-string-regexp but with modifications to: // a) reduce the size by skipping the runtime type - checking -// b) ensure it gets down - compiled for old versions of Node(the published package only supports Node 12+). +// b) ensure it gets down - compiled for old versions of Node(the published package only supports Node 14+). // // MIT License // diff --git a/packages/utils/test/normalize.test.ts b/packages/utils/test/normalize.test.ts index fda1798c3792..b01c887abedf 100644 --- a/packages/utils/test/normalize.test.ts +++ b/packages/utils/test/normalize.test.ts @@ -406,10 +406,7 @@ describe('normalize()', () => { test('primitive values', () => { expect(normalize(NaN)).toEqual('[NaN]'); expect(normalize(Symbol('dogs'))).toEqual('[Symbol(dogs)]'); - // `BigInt` doesn't exist in Node 8 - if (Number(process.versions.node.split('.')[0]) >= 10) { - expect(normalize(BigInt(1121201212312012))).toEqual('[BigInt: 1121201212312012]'); - } + expect(normalize(BigInt(1121201212312012))).toEqual('[BigInt: 1121201212312012]'); }); test('functions', () => { diff --git a/packages/vercel-edge/package.json b/packages/vercel-edge/package.json index 4257a3a83713..2ab2a932a753 100644 --- a/packages/vercel-edge/package.json +++ b/packages/vercel-edge/package.json @@ -7,7 +7,7 @@ "author": "Sentry", "license": "MIT", "engines": { - "node": ">=8" + "node": ">=14" }, "files": [ "cjs", diff --git a/packages/vue/package.json b/packages/vue/package.json index f2d93043dd94..e316ec970924 100644 --- a/packages/vue/package.json +++ b/packages/vue/package.json @@ -7,7 +7,7 @@ "author": "Sentry", "license": "MIT", "engines": { - "node": ">=8" + "node": ">=14" }, "files": [ "cjs", diff --git a/packages/wasm/package.json b/packages/wasm/package.json index 8f77b463c7c5..7507cb607757 100644 --- a/packages/wasm/package.json +++ b/packages/wasm/package.json @@ -7,7 +7,7 @@ "author": "Sentry", "license": "MIT", "engines": { - "node": ">=8" + "node": ">=14" }, "files": [ "cjs", diff --git a/scripts/node-unit-tests.ts b/scripts/node-unit-tests.ts index 9c9312e76571..c876552d2d8d 100644 --- a/scripts/node-unit-tests.ts +++ b/scripts/node-unit-tests.ts @@ -1,12 +1,9 @@ import * as childProcess from 'child_process'; -import * as fs from 'fs'; -type NodeVersion = '8' | '10' | '12' | '14' | '16'; +type NodeVersion = '14' | '16' | '18' | '20' | '21'; interface VersionConfig { ignoredPackages: Array<`@${'sentry' | 'sentry-internal'}/${string}`>; - legacyDeps: Array<`${string}@${string}`>; - shouldES6Utils: boolean; } const CURRENT_NODE_VERSION = process.version.replace('v', '').split('.')[0] as NodeVersion; @@ -29,78 +26,23 @@ const DEFAULT_SKIP_TESTS_PACKAGES = [ ]; const SKIP_TEST_PACKAGES: Record = { - '8': { - ignoredPackages: [ - '@sentry/gatsby', - '@sentry/serverless', - '@sentry/nextjs', - '@sentry/remix', - '@sentry/sveltekit', - '@sentry-internal/replay-worker', - '@sentry/node-experimental', - '@sentry/opentelemetry', - '@sentry/vercel-edge', - '@sentry/astro', - ], - legacyDeps: [ - 'jsdom@15.x', - 'jest@25.x', - 'jest-environment-jsdom@25.x', - 'jest-environment-node@25.x', - 'ts-jest@25.x', - 'lerna@3.13.4', - ], - shouldES6Utils: true, - }, - '10': { - ignoredPackages: [ - '@sentry/remix', - '@sentry/sveltekit', - '@sentry-internal/replay-worker', - '@sentry/node-experimental', - '@sentry/opentelemetry', - '@sentry/vercel-edge', - '@sentry/astro', - ], - legacyDeps: ['jsdom@16.x', 'lerna@3.13.4'], - shouldES6Utils: true, - }, - '12': { - ignoredPackages: [ - '@sentry/remix', - '@sentry/sveltekit', - '@sentry/node-experimental', - '@sentry/opentelemetry', - '@sentry/vercel-edge', - '@sentry/astro', - ], - legacyDeps: ['lerna@3.13.4'], - shouldES6Utils: true, - }, '14': { ignoredPackages: ['@sentry/sveltekit', '@sentry/vercel-edge', '@sentry/astro'], - legacyDeps: [], - shouldES6Utils: false, }, '16': { ignoredPackages: ['@sentry/vercel-edge', '@sentry/astro'], - legacyDeps: [], - shouldES6Utils: false, + }, + '18': { + ignoredPackages: [], + }, + '20': { + ignoredPackages: [], + }, + '21': { + ignoredPackages: [], }, }; -type JSONValue = string | number | boolean | null | JSONArray | JSONObject; - -type JSONObject = { - [key: string]: JSONValue; -}; - -type JSONArray = Array; - -interface TSConfigJSON extends JSONObject { - compilerOptions: { lib: string[]; target: string }; -} - /** * Run the given shell command, piping the shell process's `stdin`, `stdout`, and `stderr` to that of the current * process. Returns contents of `stdout`. @@ -109,50 +51,6 @@ function run(cmd: string, options?: childProcess.ExecSyncOptions): void { childProcess.execSync(cmd, { stdio: 'inherit', ...options }); } -/** - * Install the given legacy dependencies, for compatibility with tests run in older versions of Node. - */ -function installLegacyDeps(legacyDeps: string[] = []): void { - // Ignoring engines and scripts lets us get away with having incompatible things installed for SDK packages we're not - // testing in the current node version, and ignoring the root check lets us install things at the repo root. - run(`yarn add --dev --ignore-engines --ignore-scripts --ignore-workspace-root-check ${legacyDeps.join(' ')}`); -} - -/** - * Modify a json file on disk. - * - * @param filepath The path to the file to be modified - * @param transformer A function which takes the JSON data as input and returns a mutated version. It may mutate the - * JSON data in place, but it isn't required to do so. - */ -export function modifyJSONFile(filepath: string, transformer: (json: T) => T): void { - const fileContents = fs - .readFileSync(filepath) - .toString() - // get rid of comments, which the `jsonc` format allows, but which will crash `JSON.parse` - .replace(/\/\/.*\n/g, ''); - const json = JSON.parse(fileContents); - const newJSON = transformer(json); - fs.writeFileSync(filepath, JSON.stringify(newJSON, null, 2)); -} - -const es6ifyTestTSConfig = (pkg: string): void => { - const filepath = `packages/${pkg}/tsconfig.test.json`; - const transformer = (tsconfig: TSConfigJSON): TSConfigJSON => { - tsconfig.compilerOptions.target = 'es6'; - return tsconfig; - }; - modifyJSONFile(filepath, transformer); -}; - -/** - * Skip tests which don't run in Node 8. - * We're forced to skip these tests for compatibility reasons. - */ -function skipNodeV8Tests(): void { - run('rm -rf packages/tracing/test/browser'); -} - /** * Run tests, ignoring the given packages */ @@ -169,19 +67,9 @@ function runTests(): void { DEFAULT_SKIP_TESTS_PACKAGES.forEach(pkg => ignores.add(pkg)); - if (CURRENT_NODE_VERSION === '8') { - skipNodeV8Tests(); - } - const versionConfig = SKIP_TEST_PACKAGES[CURRENT_NODE_VERSION]; if (versionConfig) { versionConfig.ignoredPackages.forEach(dep => ignores.add(dep)); - if (versionConfig.legacyDeps.length > 0) { - installLegacyDeps(versionConfig.legacyDeps); - } - if (versionConfig.shouldES6Utils) { - es6ifyTestTSConfig('utils'); - } } runWithIgnores(Array.from(ignores));