Skip to content

Commit 81ad235

Browse files
committed
Merge branch 'develop' into timfish/remove-allowSyntheticDefaultImports
2 parents d54165d + dcb6c24 commit 81ad235

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+220
-1706
lines changed

.craft.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ targets:
8989

9090
## 5. Node-based Packages
9191
- name: npm
92-
id: '@sentry/serverless'
93-
includeNames: /^sentry-serverless-\d.*\.tgz$/
92+
id: '@sentry/aws-serverless'
93+
includeNames: /^sentry-aws-serverless-\d.*\.tgz$/
9494
- name: npm
9595
id: '@sentry/google-cloud'
9696
includeNames: /^sentry-google-cloud-\d.*\.tgz$/

.github/ISSUE_TEMPLATE/bug.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ body:
3434
- '@sentry/astro'
3535
- '@sentry/angular'
3636
- '@sentry/angular-ivy'
37+
- '@sentry/aws-serverless'
3738
- '@sentry/bun'
3839
- '@sentry/deno'
3940
- '@sentry/ember'
@@ -42,7 +43,6 @@ body:
4243
- '@sentry/node'
4344
- '@sentry/react'
4445
- '@sentry/remix'
45-
- '@sentry/serverless'
4646
- '@sentry/google-cloud'
4747
- '@sentry/svelte'
4848
- '@sentry/sveltekit'

MIGRATION.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ We've removed the following packages:
4848
- [@sentry/hub](./MIGRATION.md#sentryhub)
4949
- [@sentry/tracing](./MIGRATION.md#sentrytracing)
5050
- [@sentry/integrations](./MIGRATION.md#sentryintegrations)
51+
- [@sentry/serverless](./MIGRATION.md#sentryserverless)
5152

5253
#### @sentry/hub
5354

@@ -167,6 +168,55 @@ Integrations that are now exported from `@sentry/node` and `@sentry/browser` (or
167168

168169
The `Transaction` integration has been removed from `@sentry/integrations`. There is no replacement API.
169170

171+
#### @sentry/serverless
172+
173+
`@sentry/serverless` has been removed and will no longer be published. The serverless package has been split into two
174+
different packages, `@sentry/aws-serverless` and `@sentry/google-cloud`. These new packages have smaller bundle size
175+
than `@sentry/serverless`, which should improve your serverless cold-start times.
176+
177+
`@sentry/aws-serverless` and `@sentry/google-cloud` has also been changed to only emit CJS builds. The ESM build for the
178+
`@sentry/serverless` package was always broken and we decided to remove it entirely. ESM support will be re-added at a
179+
later date.
180+
181+
In `@sentry/serverless` you had to use a namespace import to initialize the SDK. This has been removed so that you can
182+
directly import from the SDK instead.
183+
184+
```js
185+
// v7
186+
const Sentry = require('@sentry/serverless');
187+
188+
Sentry.AWSLambda.init({
189+
dsn: '__DSN__',
190+
tracesSampleRate: 1.0,
191+
});
192+
193+
// v8
194+
const Sentry = require('@sentry/aws-serverless');
195+
196+
Sentry.init({
197+
dsn: '__DSN__',
198+
tracesSampleRate: 1.0,
199+
});
200+
```
201+
202+
```js
203+
// v7
204+
const Sentry = require('@sentry/serverless');
205+
206+
Sentry.GCPFunction.init({
207+
dsn: '__DSN__',
208+
tracesSampleRate: 1.0,
209+
});
210+
211+
// v8
212+
const Sentry = require('@sentry/google-cloud');
213+
214+
Sentry.init({
215+
dsn: '__DSN__',
216+
tracesSampleRate: 1.0,
217+
});
218+
```
219+
170220
## 3. Performance Monitoring Changes
171221

172222
- [Performance Monitoring API](./MIGRATION.md#performance-monitoring-api)

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,10 @@ package. Please refer to the README and instructions of those SDKs for more deta
5757
- [`@sentry/gatsby`](https://github.com/getsentry/sentry-javascript/tree/master/packages/gatsby): SDK for Gatsby
5858
- [`@sentry/nextjs`](https://github.com/getsentry/sentry-javascript/tree/master/packages/nextjs): SDK for Next.js
5959
- [`@sentry/remix`](https://github.com/getsentry/sentry-javascript/tree/master/packages/remix): SDK for Remix
60-
- [`@sentry/serverless`](https://github.com/getsentry/sentry-javascript/tree/master/packages/serverless): SDK for
61-
Serverless Platforms (AWS, GCP)
60+
- [`@sentry/aws-serverless`](https://github.com/getsentry/sentry-javascript/tree/master/packages/aws-serverless): SDK
61+
for AWS Lambda Functions
62+
- [`@sentry/google-cloud`](https://github.com/getsentry/sentry-javascript/tree/master/packages/google-cloud): SDK for
63+
Google Cloud Functions
6264
- [`@sentry/electron`](https://github.com/getsentry/sentry-electron): SDK for Electron with support for native crashes
6365
- [`@sentry/react-native`](https://github.com/getsentry/sentry-react-native): SDK for React Native with support for
6466
native crashes

dev-packages/e2e-tests/test-applications/node-exports-test-app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"@sentry/remix": "latest || *",
1919
"@sentry/astro": "latest || *",
2020
"@sentry/nextjs": "latest || *",
21-
"@sentry/serverless": "latest || *",
21+
"@sentry/aws-serverless": "latest || *",
2222
"@sentry/google-cloud": "latest || *",
2323
"@sentry/bun": "latest || *",
2424
"@sentry/types": "latest || *",

dev-packages/e2e-tests/test-applications/node-exports-test-app/scripts/consistentExports.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@ import * as SentryNextJs from '@sentry/nextjs';
55
import * as SentryNode from '@sentry/node';
66
import * as SentryNodeExperimental from '@sentry/node-experimental';
77
import * as SentryRemix from '@sentry/remix';
8-
import * as SentryServerless from '@sentry/serverless';
98
import * as SentrySvelteKit from '@sentry/sveltekit';
109

10+
// SentryAWS is CJS only
11+
const SentryAWS = require('@sentry/aws-serverless');
12+
1113
/* List of exports that are safe to ignore / we don't require in any depending package */
1214
const NODE_EXPERIMENTAL_EXPORTS_IGNORE = [
1315
'default',
@@ -77,10 +79,10 @@ const DEPENDENTS: Dependent[] = [
7779
exports: Object.keys(SentryRemix),
7880
},
7981
{
80-
package: '@sentry/serverless',
81-
compareWith: nodeExperimentalExports,
82-
exports: Object.keys(SentryServerless),
83-
ignoreExports: ['cron', 'hapiErrorPlugin'],
82+
package: '@sentry/aws-serverless',
83+
compareWith: nodeExports,
84+
exports: Object.keys(SentryAWS),
85+
ignoreExports: ['makeMain'],
8486
},
8587
{
8688
package: '@sentry/google-cloud',

dev-packages/e2e-tests/verdaccio-config/config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ packages:
134134
unpublish: $all
135135
# proxy: npmjs # Don't proxy for E2E tests!
136136

137-
'@sentry/serverless':
137+
'@sentry/aws-serverless':
138138
access: $all
139139
publish: $all
140140
unpublish: $all

dev-packages/rollup-utils/bundleHelpers.mjs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
makeCleanupPlugin,
1212
makeCommonJSPlugin,
1313
makeIsDebugBuildPlugin,
14+
makeJsonPlugin,
1415
makeLicensePlugin,
1516
makeNodeResolvePlugin,
1617
makeRrwebBuildPlugin,
@@ -40,6 +41,8 @@ export function makeBaseBundleConfig(options) {
4041
// at all, and without `transformMixedEsModules`, they're only included if they're imported, not if they're required.)
4142
const commonJSPlugin = makeCommonJSPlugin({ transformMixedEsModules: true });
4243

44+
const jsonPlugin = makeJsonPlugin();
45+
4346
// used by `@sentry/browser`
4447
const standAloneBundleConfig = {
4548
output: {
@@ -84,12 +87,12 @@ export function makeBaseBundleConfig(options) {
8487
plugins: [rrwebBuildPlugin, markAsBrowserBuildPlugin],
8588
};
8689

87-
// used by `@sentry/serverless`, when creating the lambda layer
90+
// used by `@sentry/aws-serverless`, when creating the lambda layer
8891
const nodeBundleConfig = {
8992
output: {
9093
format: 'cjs',
9194
},
92-
plugins: [commonJSPlugin],
95+
plugins: [jsonPlugin, commonJSPlugin],
9396
// Don't bundle any of Node's core modules
9497
external: builtinModules,
9598
};

dev-packages/rollup-utils/npmHelpers.mjs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,16 @@ export function makeBaseNPMConfig(options = {}) {
120120
});
121121
}
122122

123-
export function makeNPMConfigVariants(baseConfig) {
124-
const variantSpecificConfigs = [
125-
{ output: { format: 'cjs', dir: path.join(baseConfig.output.dir, 'cjs') } },
126-
{ output: { format: 'esm', dir: path.join(baseConfig.output.dir, 'esm'), plugins: [makePackageNodeEsm()] } },
127-
];
123+
export function makeNPMConfigVariants(baseConfig, options = {}) {
124+
const { emitEsm = true } = options;
125+
126+
const variantSpecificConfigs = [{ output: { format: 'cjs', dir: path.join(baseConfig.output.dir, 'cjs') } }];
127+
128+
if (emitEsm) {
129+
variantSpecificConfigs.push({
130+
output: { format: 'esm', dir: path.join(baseConfig.output.dir, 'esm'), plugins: [makePackageNodeEsm()] },
131+
});
132+
}
128133

129134
return variantSpecificConfigs.map(variant => deepMerge(baseConfig, variant));
130135
}

dev-packages/rollup-utils/plugins/npmPlugins.mjs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
* Sucrase plugin docs: https://github.com/rollup/plugins/tree/master/packages/sucrase
88
*/
99

10+
import json from '@rollup/plugin-json';
1011
import replace from '@rollup/plugin-replace';
1112
import sucrase from '@rollup/plugin-sucrase';
1213
import cleanup from 'rollup-plugin-cleanup';
@@ -18,11 +19,17 @@ import cleanup from 'rollup-plugin-cleanup';
1819
*/
1920
export function makeSucrasePlugin(options = {}) {
2021
return sucrase({
22+
// Required for bundling OTEL code properly
23+
exclude: ['**/*.json'],
2124
transforms: ['typescript', 'jsx'],
2225
...options,
2326
});
2427
}
2528

29+
export function makeJsonPlugin() {
30+
return json();
31+
}
32+
2633
/**
2734
* Create a plugin which can be used to pause the build process at the given hook.
2835
*

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
"packages/angular",
4848
"packages/angular-ivy",
4949
"packages/astro",
50+
"packages/aws-serverless",
5051
"packages/browser",
5152
"packages/bun",
5253
"packages/core",
@@ -68,7 +69,6 @@
6869
"packages/replay",
6970
"packages/replay-canvas",
7071
"packages/replay-worker",
71-
"packages/serverless",
7272
"packages/svelte",
7373
"packages/sveltekit",
7474
"packages/tracing-internal",
@@ -87,6 +87,7 @@
8787
"devDependencies": {
8888
"@biomejs/biome": "^1.4.0",
8989
"@rollup/plugin-commonjs": "^21.0.1",
90+
"@rollup/plugin-json": "^6.1.0",
9091
"@rollup/plugin-node-resolve": "^13.1.3",
9192
"@rollup/plugin-replace": "^3.0.1",
9293
"@rollup/plugin-sucrase": "^4.0.3",
File renamed without changes.

packages/serverless/README.md renamed to packages/aws-serverless/README.md

Lines changed: 8 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -14,37 +14,37 @@
1414
## General
1515

1616
This package is a wrapper around `@sentry/node`, with added functionality related to various Serverless solutions. All
17-
methods available in `@sentry/node` can be imported from `@sentry/serverless`.
17+
methods available in `@sentry/node` can be imported from `@sentry/aws-serverless`.
1818

1919
Currently supported environment:
2020

2121
### AWS Lambda
2222

23-
To use this SDK, call `Sentry.AWSLambda.init(options)` at the very beginning of your JavaScript file.
23+
To use this SDK, call `Sentry.init(options)` at the very beginning of your JavaScript file.
2424

2525
```javascript
26-
import * as Sentry from '@sentry/serverless';
26+
import * as Sentry from '@sentry/aws-serverless';
2727

28-
Sentry.AWSLambda.init({
28+
Sentry.init({
2929
dsn: '__DSN__',
3030
// ...
3131
});
3232

3333
// async (recommended)
34-
exports.handler = Sentry.AWSLambda.wrapHandler(async (event, context) => {
34+
exports.handler = Sentry.wrapHandler(async (event, context) => {
3535
throw new Error('oh, hello there!');
3636
});
3737

3838
// sync
39-
exports.handler = Sentry.AWSLambda.wrapHandler((event, context, callback) => {
39+
exports.handler = Sentry.wrapHandler((event, context, callback) => {
4040
throw new Error('oh, hello there!');
4141
});
4242
```
4343

4444
If you also want to trace performance of all the incoming requests and also outgoing AWS service requests, just set the `tracesSampleRate` option.
4545

4646
```javascript
47-
import * as Sentry from '@sentry/serverless';
47+
import * as Sentry from '@sentry/aws-serverless';
4848

4949
Sentry.AWSLambda.init({
5050
dsn: '__DSN__',
@@ -59,38 +59,6 @@ Another and much simpler way to integrate Sentry to your AWS Lambda function is
5959
1. Choose Layers -> Add Layer.
6060
2. Specify an ARN: `arn:aws:lambda:us-west-1:TODO:layer:TODO:VERSION`.
6161
3. Go to Environment variables and add:
62-
- `NODE_OPTIONS`: `-r @sentry/serverless/build/npm/cjs/awslambda-auto`.
62+
- `NODE_OPTIONS`: `-r @sentry/aws-serverless/build/npm/cjs/awslambda-auto`.
6363
- `SENTRY_DSN`: `your dsn`.
6464
- `SENTRY_TRACES_SAMPLE_RATE`: a number between 0 and 1 representing the chance a transaction is sent to Sentry. For more information, see [docs](https://docs.sentry.io/platforms/node/guides/aws-lambda/configuration/options/#tracesSampleRate).
65-
66-
### Google Cloud Functions
67-
68-
To use this SDK, call `Sentry.GCPFunction.init(options)` at the very beginning of your JavaScript file.
69-
70-
```javascript
71-
import * as Sentry from '@sentry/serverless';
72-
73-
Sentry.GCPFunction.init({
74-
dsn: '__DSN__',
75-
tracesSampleRate: 1.0,
76-
// ...
77-
});
78-
79-
// For HTTP Functions:
80-
81-
exports.helloHttp = Sentry.GCPFunction.wrapHttpFunction((req, res) => {
82-
throw new Error('oh, hello there!');
83-
});
84-
85-
// For Background Functions:
86-
87-
exports.helloEvents = Sentry.GCPFunction.wrapEventFunction((data, context, callback) => {
88-
throw new Error('oh, hello there!');
89-
});
90-
91-
// For CloudEvents:
92-
93-
exports.helloEvents = Sentry.GCPFunction.wrapCloudEventFunction((context, callback) => {
94-
throw new Error('oh, hello there!');
95-
});
96-
```

packages/serverless/package.json renamed to packages/aws-serverless/package.json

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"name": "@sentry/serverless",
2+
"name": "@sentry/aws-serverless",
33
"version": "8.0.0-alpha.2",
4-
"description": "Official Sentry SDK for various serverless solutions",
4+
"description": "Official Sentry SDK for AWS Lambda and AWS Serverless Environments",
55
"repository": "git://github.com/getsentry/sentry-javascript.git",
66
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/serverless",
77
"author": "Sentry",
@@ -11,20 +11,14 @@
1111
},
1212
"files": [
1313
"cjs",
14-
"esm",
1514
"types",
1615
"types-ts3.8"
1716
],
1817
"main": "build/npm/cjs/index.js",
19-
"module": "build/npm/esm/index.js",
2018
"types": "build/npm/types/index.d.ts",
2119
"exports": {
2220
"./package.json": "./package.json",
2321
".": {
24-
"import": {
25-
"types": "./build/npm/types/index.d.ts",
26-
"default": "./build/npm/esm/index.js"
27-
},
2822
"require": {
2923
"types": "./build/npm/types/index.d.ts",
3024
"default": "./build/npm/cjs/index.js"
@@ -43,21 +37,16 @@
4337
},
4438
"dependencies": {
4539
"@sentry/core": "8.0.0-alpha.2",
46-
"@sentry/node-experimental": "8.0.0-alpha.2",
40+
"@sentry/node": "8.0.0-alpha.2",
4741
"@sentry/types": "8.0.0-alpha.2",
4842
"@sentry/utils": "8.0.0-alpha.2",
4943
"@types/aws-lambda": "^8.10.62",
5044
"@types/express": "^4.17.14"
5145
},
5246
"devDependencies": {
53-
"@google-cloud/bigquery": "^5.3.0",
54-
"@google-cloud/common": "^3.4.1",
55-
"@google-cloud/functions-framework": "^1.7.1",
56-
"@google-cloud/pubsub": "^2.5.0",
5747
"@types/node": "^14.6.4",
5848
"aws-sdk": "^2.765.0",
5949
"find-up": "^5.0.0",
60-
"google-gax": "^2.9.0",
6150
"nock": "^13.0.4",
6251
"npm-packlist": "^2.1.4"
6352
},

0 commit comments

Comments
 (0)