@sentry/solidstart 11.0.0 → 11.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -284
- package/build/esm/package.json +1 -1
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -10,292 +10,18 @@
|
|
|
10
10
|
[](https://www.npmjs.com/package/@sentry/solidstart)
|
|
11
11
|
[](https://www.npmjs.com/package/@sentry/solidstart)
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
[GitHub](https://github.com/getsentry/sentry-javascript/issues/new/choose) if you have any feedback or concerns. This
|
|
15
|
-
SDK is for [SolidStart](https://start.solidjs.com/). If you're using [Solid](https://www.solidjs.com/) see our
|
|
16
|
-
[Solid SDK here](https://github.com/getsentry/sentry-javascript/tree/develop/packages/solid).
|
|
17
|
-
|
|
18
|
-
## Links
|
|
19
|
-
|
|
20
|
-
- [Official SDK Docs](https://docs.sentry.io/platforms/javascript/guides/solidstart/)
|
|
21
|
-
|
|
22
|
-
## General
|
|
23
|
-
|
|
24
|
-
This package is a wrapper around `@sentry/node` for the server and `@sentry/solid` for the client side, with added
|
|
25
|
-
functionality related to SolidStart.
|
|
26
|
-
|
|
27
|
-
## SolidStart version support
|
|
28
|
-
|
|
29
|
-
The setup differs by SolidStart major, because SolidStart 2 dropped vinxi and `app.config.ts`:
|
|
30
|
-
|
|
31
|
-
- **SolidStart 1** — configure the SDK with `withSentry` in `app.config.ts`. This is what the "Manual Setup" section
|
|
32
|
-
below describes.
|
|
33
|
-
- **SolidStart 2** — configure the SDK with the `sentrySolidStart` Vite plugin in `vite.config.ts`. See
|
|
34
|
-
[SolidStart 2 setup](#solidstart-2-setup).
|
|
35
|
-
|
|
36
|
-
## Manual Setup
|
|
37
|
-
|
|
38
|
-
If the setup through the wizard doesn't work for you, you can also set up the SDK manually.
|
|
39
|
-
|
|
40
|
-
### 1. Prerequisites & Installation
|
|
41
|
-
|
|
42
|
-
Install the Sentry SolidStart SDK:
|
|
43
|
-
|
|
44
|
-
```bash
|
|
45
|
-
# Using npm
|
|
46
|
-
npm install @sentry/solidstart
|
|
47
|
-
|
|
48
|
-
# Using yarn
|
|
49
|
-
yarn add @sentry/solidstart
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
### 2. Client-side Setup
|
|
53
|
-
|
|
54
|
-
Initialize the SDK in `entry-client.jsx`
|
|
55
|
-
|
|
56
|
-
```jsx
|
|
57
|
-
import * as Sentry from '@sentry/solidstart';
|
|
58
|
-
import { solidRouterBrowserTracingIntegration } from '@sentry/solidstart/solidrouter';
|
|
59
|
-
import { mount, StartClient } from '@solidjs/start/client';
|
|
60
|
-
|
|
61
|
-
Sentry.init({
|
|
62
|
-
dsn: '__PUBLIC_DSN__',
|
|
63
|
-
integrations: [solidRouterBrowserTracingIntegration()],
|
|
64
|
-
tracesSampleRate: 1.0, // Capture 100% of the transactions
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
mount(() => <StartClient />, document.getElementById('app'));
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
### 3. Server-side Setup
|
|
71
|
-
|
|
72
|
-
Create an instrument file named `src/instrument.server.ts` and add your initialization code for the server-side SDK.
|
|
73
|
-
|
|
74
|
-
```javascript
|
|
75
|
-
import * as Sentry from '@sentry/solidstart';
|
|
76
|
-
|
|
77
|
-
Sentry.init({
|
|
78
|
-
dsn: '__PUBLIC_DSN__',
|
|
79
|
-
tracesSampleRate: 1.0, // Capture 100% of the transactions
|
|
80
|
-
});
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
### 4. Server instrumentation
|
|
84
|
-
|
|
85
|
-
Complete the setup by adding the Sentry middleware to your `src/middleware.ts` file:
|
|
86
|
-
|
|
87
|
-
```typescript
|
|
88
|
-
import { sentryBeforeResponseMiddleware } from '@sentry/solidstart';
|
|
89
|
-
import { createMiddleware } from '@solidjs/start/middleware';
|
|
90
|
-
|
|
91
|
-
export default createMiddleware({
|
|
92
|
-
onBeforeResponse: [
|
|
93
|
-
sentryBeforeResponseMiddleware(),
|
|
94
|
-
// Add your other middleware handlers after `sentryBeforeResponseMiddleware`
|
|
95
|
-
],
|
|
96
|
-
});
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
And don't forget to specify `./src/middleware.ts` in your `app.config.ts`:
|
|
100
|
-
|
|
101
|
-
```typescript
|
|
102
|
-
import { defineConfig } from '@solidjs/start/config';
|
|
103
|
-
|
|
104
|
-
export default defineConfig({
|
|
105
|
-
// ...
|
|
106
|
-
middleware: './src/middleware.ts',
|
|
107
|
-
});
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
The Sentry middleware enhances the data collected by Sentry on the server side by enabling distributed tracing between
|
|
111
|
-
the client and server.
|
|
112
|
-
|
|
113
|
-
### 5. Configure your application
|
|
114
|
-
|
|
115
|
-
For Sentry to work properly, SolidStart's `app.config.ts` has to be modified. Wrap your config with `withSentry` and
|
|
116
|
-
configure it to upload source maps.
|
|
117
|
-
|
|
118
|
-
If your `instrument.server.ts` file is not located in the `src` folder, you can specify the path via the
|
|
119
|
-
`instrumentation` option to `withSentry`.
|
|
13
|
+
The official Sentry SDK for monitoring SolidStart applications.
|
|
120
14
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
building your project. We recommend adding the auth token to your CI/CD environment as an environment variable.
|
|
124
|
-
|
|
125
|
-
Learn more about configuring the plugin in our
|
|
126
|
-
[Sentry Vite Plugin documentation](https://www.npmjs.com/package/@sentry/vite-plugin).
|
|
127
|
-
|
|
128
|
-
```typescript
|
|
129
|
-
import { defineConfig } from '@solidjs/start/config';
|
|
130
|
-
import { withSentry } from '@sentry/solidstart';
|
|
131
|
-
|
|
132
|
-
export default defineConfig(
|
|
133
|
-
withSentry(
|
|
134
|
-
{
|
|
135
|
-
// SolidStart config
|
|
136
|
-
middleware: './src/middleware.ts',
|
|
137
|
-
},
|
|
138
|
-
{
|
|
139
|
-
// Sentry `withSentry` options
|
|
140
|
-
org: process.env.SENTRY_ORG,
|
|
141
|
-
project: process.env.SENTRY_PROJECT,
|
|
142
|
-
authToken: process.env.SENTRY_AUTH_TOKEN,
|
|
143
|
-
debug: true,
|
|
144
|
-
// optional: if your `instrument.server.ts` file is not located inside `src`
|
|
145
|
-
instrumentation: './mypath/instrument.server.ts',
|
|
146
|
-
},
|
|
147
|
-
),
|
|
148
|
-
);
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
### 6. Run your application
|
|
152
|
-
|
|
153
|
-
Then run your app
|
|
154
|
-
|
|
155
|
-
```bash
|
|
156
|
-
NODE_OPTIONS='--import=./.output/server/instrument.server.mjs' yarn start
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
⚠️ **Note build presets** ⚠️
|
|
160
|
-
Depending on [build preset](https://nitro.unjs.io/deploy), the location of `instrument.server.mjs` differs. To find out
|
|
161
|
-
where `instrument.server.mjs` is located, monitor the build log output for
|
|
162
|
-
|
|
163
|
-
```bash
|
|
164
|
-
[Sentry SolidStart withSentry] Successfully created /my/project/path/.output/server/instrument.server.mjs.
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
⚠️ **Note for platforms without the ability to modify `NODE_OPTIONS` or use `--import`** ⚠️
|
|
168
|
-
Depending on where the application is deployed to, it might not be possible to modify or use `NODE_OPTIONS` to import
|
|
169
|
-
`instrument.server.mjs`.
|
|
170
|
-
|
|
171
|
-
For such platforms, we offer the option `autoInjectServerSentry: 'top-level-import'` to add a top level import of
|
|
172
|
-
`instrument.server.mjs` to the server entry file.
|
|
173
|
-
|
|
174
|
-
```typescript
|
|
175
|
-
import { defineConfig } from '@solidjs/start/config';
|
|
176
|
-
import { withSentry } from '@sentry/solidstart';
|
|
177
|
-
|
|
178
|
-
export default defineConfig(
|
|
179
|
-
withSentry(
|
|
180
|
-
{
|
|
181
|
-
// ...
|
|
182
|
-
middleware: './src/middleware.ts',
|
|
183
|
-
},
|
|
184
|
-
{
|
|
185
|
-
org: process.env.SENTRY_ORG,
|
|
186
|
-
project: process.env.SENTRY_PROJECT,
|
|
187
|
-
authToken: process.env.SENTRY_AUTH_TOKEN,
|
|
188
|
-
debug: true,
|
|
189
|
-
// optional: if your `instrument.server.ts` file is not located inside `src`
|
|
190
|
-
instrumentation: './mypath/instrument.server.ts',
|
|
191
|
-
// optional: if NODE_OPTIONS or --import is not avaiable
|
|
192
|
-
autoInjectServerSentry: 'top-level-import',
|
|
193
|
-
},
|
|
194
|
-
),
|
|
195
|
-
);
|
|
196
|
-
```
|
|
197
|
-
|
|
198
|
-
This has a **fundamental restriction**: It only supports limited performance instrumentation. **Only basic http
|
|
199
|
-
instrumentation** will work, and no DB or framework-specific instrumentation will be available.
|
|
200
|
-
|
|
201
|
-
# SolidStart 2 setup
|
|
202
|
-
|
|
203
|
-
SolidStart 2 has no `app.config.ts`, so `withSentry` does not apply. Configure the SDK with the `sentrySolidStart`
|
|
204
|
-
Vite plugin instead. Client-side setup (`Sentry.init` in `entry-client.tsx`) and the Solid Router and
|
|
205
|
-
`ErrorBoundary` wrappers below are unchanged.
|
|
206
|
-
|
|
207
|
-
### 1. Add the Vite plugin
|
|
208
|
-
|
|
209
|
-
```typescript
|
|
210
|
-
// vite.config.ts
|
|
211
|
-
import { sentrySolidStart } from '@sentry/solidstart/vite';
|
|
212
|
-
import { solidStart } from '@solidjs/start/config';
|
|
213
|
-
import { nitro } from 'nitro/vite';
|
|
214
|
-
import { defineConfig } from 'vite';
|
|
215
|
-
|
|
216
|
-
export default defineConfig({
|
|
217
|
-
plugins: [
|
|
218
|
-
solidStart(),
|
|
219
|
-
sentrySolidStart({
|
|
220
|
-
org: process.env.SENTRY_ORG,
|
|
221
|
-
project: process.env.SENTRY_PROJECT,
|
|
222
|
-
authToken: process.env.SENTRY_AUTH_TOKEN,
|
|
223
|
-
}),
|
|
224
|
-
// `serverDir` is required for Nitro to pick up the Sentry plugin below.
|
|
225
|
-
nitro({ serverDir: './server' }),
|
|
226
|
-
],
|
|
227
|
-
});
|
|
228
|
-
```
|
|
229
|
-
|
|
230
|
-
### 2. Initialize Sentry on the server
|
|
231
|
-
|
|
232
|
-
Create a Nitro plugin. Nitro runs it once at server startup, before any request is handled:
|
|
233
|
-
|
|
234
|
-
```typescript
|
|
235
|
-
// server/plugins/sentry.ts
|
|
236
|
-
import * as Sentry from '@sentry/solidstart';
|
|
237
|
-
import { definePlugin } from 'nitro';
|
|
238
|
-
|
|
239
|
-
export default definePlugin(() => {
|
|
240
|
-
Sentry.init({
|
|
241
|
-
dsn: '__PUBLIC_DSN__',
|
|
242
|
-
tracesSampleRate: 1.0,
|
|
243
|
-
});
|
|
244
|
-
});
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
Nitro's `serverDir` defaults to `false`, which disables plugin scanning entirely. If it is not set (step 1), this
|
|
248
|
-
file is silently ignored and Sentry never initializes on the server.
|
|
249
|
-
|
|
250
|
-
Unlike SolidStart 1, there is **no `--import` flag and no instrumentation file to copy** into the build output. The
|
|
251
|
-
SDK instruments your server dependencies at build time, so a plain start command is all that is needed:
|
|
252
|
-
|
|
253
|
-
```bash
|
|
254
|
-
node .output/server/index.mjs
|
|
255
|
-
```
|
|
256
|
-
|
|
257
|
-
# Solid Router
|
|
258
|
-
|
|
259
|
-
The Solid Router instrumentation uses the Solid Router library to create navigation spans to ensure you collect
|
|
260
|
-
meaningful performance data about the health of your page loads and associated requests.
|
|
261
|
-
|
|
262
|
-
Wrap `Router`, `MemoryRouter` or `HashRouter` from `@solidjs/router` using `withSentryRouterRouting`. This creates a
|
|
263
|
-
higher order component, which will enable Sentry to reach your router context.
|
|
264
|
-
|
|
265
|
-
```js
|
|
266
|
-
import { withSentryRouterRouting } from '@sentry/solidstart/solidrouter';
|
|
267
|
-
import { Route, Router } from '@solidjs/router';
|
|
268
|
-
|
|
269
|
-
const SentryRouter = withSentryRouterRouting(Router);
|
|
270
|
-
|
|
271
|
-
render(
|
|
272
|
-
() => (
|
|
273
|
-
<SentryRouter>
|
|
274
|
-
<Route path="/" component={App} />
|
|
275
|
-
...
|
|
276
|
-
</SentryRouter>
|
|
277
|
-
),
|
|
278
|
-
document.getElementById('root'),
|
|
279
|
-
);
|
|
280
|
-
```
|
|
281
|
-
|
|
282
|
-
# Solid ErrorBoundary
|
|
15
|
+
This SDK is in **Beta**. The API is stable but updates may include minor changes in behavior. Please reach out on
|
|
16
|
+
[GitHub](https://github.com/getsentry/sentry-javascript/issues/new/choose) if you have any feedback or concerns.
|
|
283
17
|
|
|
284
|
-
|
|
285
|
-
JS `ErrorBoundary` component with `Sentry.withSentryErrorBoundary`.
|
|
18
|
+
## Documentation
|
|
286
19
|
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
20
|
+
- [Getting started](https://docs.sentry.io/platforms/javascript/guides/solidstart/)
|
|
21
|
+
- [Configuration](https://docs.sentry.io/platforms/javascript/guides/solidstart/configuration/)
|
|
22
|
+
- [SolidStart-specific features](https://docs.sentry.io/platforms/javascript/guides/solidstart/features/)
|
|
290
23
|
|
|
291
|
-
|
|
24
|
+
## Support
|
|
292
25
|
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
<SentryErrorBoundary fallback={err => <div>Error: {err.message}</div>}>
|
|
296
|
-
<ProblematicComponent />
|
|
297
|
-
</SentryErrorBoundary>
|
|
298
|
-
),
|
|
299
|
-
document.getElementById('root'),
|
|
300
|
-
);
|
|
301
|
-
```
|
|
26
|
+
- [Report a bug](https://github.com/getsentry/sentry-javascript/issues/new/choose)
|
|
27
|
+
- [Contributing](https://github.com/getsentry/sentry-javascript/blob/develop/CONTRIBUTING.md)
|
package/build/esm/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"type":"module","version":"11.
|
|
1
|
+
{"type":"module","version":"11.1.0"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/solidstart",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.1.0",
|
|
4
4
|
"description": "Official Sentry SDK for Solid Start",
|
|
5
5
|
"repository": "git://github.com/getsentry/sentry-javascript.git",
|
|
6
6
|
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/solidstart",
|
|
@@ -80,14 +80,14 @@
|
|
|
80
80
|
}
|
|
81
81
|
},
|
|
82
82
|
"dependencies": {
|
|
83
|
-
"@sentry/core": "11.
|
|
84
|
-
"@sentry/nitro": "11.
|
|
85
|
-
"@sentry/node": "11.
|
|
86
|
-
"@sentry/server-runtime-injection": "11.
|
|
87
|
-
"@sentry/server-utils": "11.
|
|
88
|
-
"@sentry/solid": "11.
|
|
89
|
-
"@sentry/bundler-plugins": "11.
|
|
90
|
-
"@sentry/conventions": "0.
|
|
83
|
+
"@sentry/core": "11.1.0",
|
|
84
|
+
"@sentry/nitro": "11.1.0",
|
|
85
|
+
"@sentry/node": "11.1.0",
|
|
86
|
+
"@sentry/server-runtime-injection": "11.1.0",
|
|
87
|
+
"@sentry/server-utils": "11.1.0",
|
|
88
|
+
"@sentry/solid": "11.1.0",
|
|
89
|
+
"@sentry/bundler-plugins": "11.1.0",
|
|
90
|
+
"@sentry/conventions": "0.24.0"
|
|
91
91
|
},
|
|
92
92
|
"devDependencies": {
|
|
93
93
|
"@solidjs/router": "^1.0.0",
|