Skip to content

Commit

Permalink
Document optional instrumentation file path option
Browse files Browse the repository at this point in the history
  • Loading branch information
andreiborza committed Sep 25, 2024
1 parent 14a749a commit 5e1af7a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
6 changes: 5 additions & 1 deletion packages/solidstart/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ mount(() => <StartClient />, document.getElementById('app'));

### 3. Server-side Setup

Create an instrument file named `instrument.server.mjs` and add your initialization code for the server-side SDK.
Create an instrument file named `src/instrument.server.ts` and add your initialization code for the server-side SDK.

```javascript
import * as Sentry from '@sentry/solidstart';
Expand Down Expand Up @@ -125,6 +125,8 @@ export default defineConfig(withSentry({
Sentry relies on running `instrument.server.ts` as early as possible. Add the `sentrySolidStartVite` plugin
from `@sentry/solidstart` to your `app.config.ts`. This takes care of building `instrument.server.ts` and placing it alongside the server entry file.

If your `instrument.server.ts` file is not located in the `src` folder, you can specify the path via the `sentrySolidStartVite` plugin.

To upload source maps, configure an auth token. Auth tokens can be passed to the plugin explicitly with the `authToken` option, with a
`SENTRY_AUTH_TOKEN` environment variable, or with an `.env.sentry-build-plugin` file in the working directory when
building your project. We recommend you add the auth token to your CI/CD environment as an environment variable.
Expand All @@ -147,6 +149,8 @@ export default defineConfig(withSentry({
project: process.env.SENTRY_PROJECT,
authToken: process.env.SENTRY_AUTH_TOKEN,
debug: true,
// optional: if your `instrument.server.ts` file is not located inside `src`
instrumentation: './mypath/instrument.server.ts'
}),
],
},
Expand Down
2 changes: 1 addition & 1 deletion packages/solidstart/src/config/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export type Nitro = {

export type SolidStartInlineConfig = Parameters<typeof defineConfig>[0];

export type SolidStartInlineConfigNitroHooks = {
export type SolidStartInlineServerConfig = {
hooks?: {
close?: () => unknown;
'rollup:before'?: (nitro: Nitro) => unknown;
Expand Down
4 changes: 2 additions & 2 deletions packages/solidstart/src/config/withSentry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import type {
Nitro,
SentrySolidStartConfigOptions,
SolidStartInlineConfig,
SolidStartInlineConfigNitroHooks,
SolidStartInlineServerConfig,
} from './types';

/**
Expand All @@ -22,7 +22,7 @@ export const withSentry = (
solidStartConfig: SolidStartInlineConfig = {},
sentrySolidStartConfigOptions: SentrySolidStartConfigOptions = {},
): SolidStartInlineConfig => {
const server = (solidStartConfig.server || {}) as SolidStartInlineConfigNitroHooks;
const server = (solidStartConfig.server || {}) as SolidStartInlineServerConfig;
const hooks = server.hooks || {};

let serverDir: string;
Expand Down
6 changes: 3 additions & 3 deletions packages/solidstart/src/vite/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,10 @@ export type SentrySolidStartPluginOptions = {
debug?: boolean;

/**
* The path to your `instrumentation.server.ts|js` file.
* e.g. './src/instrumentation.server.ts`
* The path to your `instrument.server.ts|js` file.
* e.g. `./src/instrument.server.ts`
*
* Defaults to: `./src/instrumentation.server.ts`
* Defaults to: `./src/instrument.server.ts`
*/
instrumentation?: string;
};

0 comments on commit 5e1af7a

Please sign in to comment.