Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .craft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ targets:
- name: npm
id: '@sentry/tanstackstart-react'
includeNames: /^sentry-tanstackstart-react-\d.*\.tgz$/
- name: npm
id: '@sentry/vinext'
includeNames: /^sentry-vinext-\d.*\.tgz$/
- name: npm
id: '@sentry/gatsby'
includeNames: /^sentry-gatsby-\d.*\.tgz$/
Expand Down
2 changes: 2 additions & 0 deletions dev-packages/e2e-tests/test-applications/vinext-app/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@sentry:registry=http://127.0.0.1:4873
@sentry-internal:registry=http://127.0.0.1:4873
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import * as Sentry from '@sentry/vinext';

Sentry.init({
environment: 'qa',
dsn: process.env.E2E_TEST_DSN,
tunnel: 'http://localhost:3031/',
tracesSampleRate: 1,
transportOptions: {
bufferSize: 1000,
},
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import * as Sentry from '@sentry/vinext';

export async function register() {
Sentry.init({
environment: 'qa',
dsn: process.env.E2E_TEST_DSN,
tunnel: 'http://localhost:3031/',
tracesSampleRate: 1,
transportOptions: {
bufferSize: 1000,
},
});
}

export const onRequestError = Sentry.captureRequestError;
30 changes: 30 additions & 0 deletions dev-packages/e2e-tests/test-applications/vinext-app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "vinext-app-e2e-test",
"private": true,
"type": "module",
"scripts": {
"dev": "vinext dev",
"build": "vinext build",
"start": "vinext start --port 3030",
"test": "playwright test",
"test:build": "pnpm install && pnpm build",
"test:assert": "pnpm test"
},
"dependencies": {
"@sentry/vinext": "latest || *",
"react": "^19.2.4",
"react-dom": "^19.2.4"
},
"devDependencies": {
"@playwright/test": "~1.56.0",
"@sentry-internal/test-utils": "link:../../../test-utils",
"@vitejs/plugin-rsc": "^0.5.20",
"typescript": "~5.5.0",
"vinext": "^0.0.19",
"vite": "^7.3.1"
},
"volta": {
"extends": "../../package.json",
"node": "22.18.0"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { getPlaywrightConfig } from '@sentry-internal/test-utils';

const config = getPlaywrightConfig({
startCommand: `pnpm start`,
port: 3030,
});

export default config;
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export async function GET() {
return new Response(JSON.stringify({ message: 'Hello from vinext API!' }), {
headers: { 'content-type': 'application/json' },
});
}

export async function POST() {
throw new Error('API Route Error');
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
'use client';

export default function ErrorButton() {
return (
<button
id="error-button"
onClick={() => {
throw new Error('E2E Test Error');
}}
>
Throw Error
</button>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import ErrorButton from './ErrorButton';

export default function ErrorPage() {
return (
<div>
<h1>Error Test Page</h1>
<ErrorButton />
</div>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html lang="en">
<body>{children}</body>
</html>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export default function Home() {
return (
<div>
<h1>Vinext E2E Test App</h1>
<a href="/error-page">Error Page</a>
</div>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { startEventProxyServer } from '@sentry-internal/test-utils';

startEventProxyServer({
port: 3031,
proxyServerName: 'vinext-app',
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { expect, test } from '@playwright/test';
import { waitForError } from '@sentry-internal/test-utils';

test('captures a client-side error', async ({ page }) => {
const errorEventPromise = waitForError('vinext-app', errorEvent => {
return errorEvent?.exception?.values?.[0]?.value === 'E2E Test Error';
});

await page.goto('/error-page');
await page.locator('#error-button').click();

const errorEvent = await errorEventPromise;

expect(errorEvent.exception?.values?.[0]).toMatchObject({
type: 'Error',
value: 'E2E Test Error',
});
});

test('captures a server-side API route error', async ({ baseURL }) => {
const errorEventPromise = waitForError('vinext-app', errorEvent => {
return errorEvent?.exception?.values?.[0]?.value === 'API Route Error';
});

await fetch(`${baseURL}/api/test`, { method: 'POST' });

const errorEvent = await errorEventPromise;

expect(errorEvent.exception?.values?.[0]).toMatchObject({
type: 'Error',
value: 'API Route Error',
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { expect, test } from '@playwright/test';
import { waitForTransaction } from '@sentry-internal/test-utils';

test('creates a pageload transaction', async ({ page }) => {
const transactionPromise = waitForTransaction('vinext-app', transactionEvent => {
return transactionEvent?.contexts?.trace?.op === 'pageload';
});

await page.goto('/');

const transaction = await transactionPromise;

expect(transaction.contexts?.trace).toMatchObject({
op: 'pageload',
});
});

test('creates a transaction for API routes', async ({ baseURL }) => {
const transactionPromise = waitForTransaction('vinext-app', transactionEvent => {
return transactionEvent?.transaction === 'GET /api/test';
});

await fetch(`${baseURL}/api/test`);

const transaction = await transactionPromise;

expect(transaction.transaction).toBe('GET /api/test');
expect(transaction.contexts?.trace?.op).toBe('http.server');
});
12 changes: 12 additions & 0 deletions dev-packages/e2e-tests/test-applications/vinext-app/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"compilerOptions": {
"target": "ES2020",
"module": "ESNext",
"moduleResolution": "bundler",
"jsx": "react-jsx",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true
},
"include": ["src/**/*", "*.ts", "*.mts"]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { defineConfig } from 'vite';
import vinext from 'vinext';
import { sentryVinext } from '@sentry/vinext/vite';

export default defineConfig({
plugins: [vinext(), sentryVinext()],
});
6 changes: 6 additions & 0 deletions dev-packages/e2e-tests/verdaccio-config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,12 @@ packages:
unpublish: $all
# proxy: npmjs # Don't proxy for E2E tests!

'@sentry/vinext':
access: $all
publish: $all
unpublish: $all
# proxy: npmjs # Don't proxy for E2E tests!

'@sentry/wasm':
access: $all
publish: $all
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
"packages/types",
"packages/typescript",
"packages/vercel-edge",
"packages/vinext",
"packages/vue",
"packages/wasm",
"dev-packages/browser-integration-tests",
Expand Down
22 changes: 22 additions & 0 deletions packages/vinext/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
module.exports = {
env: {
browser: true,
node: true,
},
overrides: [
{
files: ['vite.config.ts'],
parserOptions: {
project: ['tsconfig.test.json'],
},
},
{
files: ['src/vite/**', 'src/server/**'],
rules: {
'@sentry-internal/sdk/no-optional-chaining': 'off',
'@sentry-internal/sdk/no-nullish-coalescing': 'off',
},
},
],
extends: ['../../.eslintrc.js'],
};
21 changes: 21 additions & 0 deletions packages/vinext/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Functional Software, Inc. dba Sentry

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
18 changes: 18 additions & 0 deletions packages/vinext/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<p align="center">
<a href="https://sentry.io/?utm_source=github&utm_medium=logo" target="_blank">
<img src="https://sentry-brand.storage.googleapis.com/sentry-wordmark-dark-280x84.png" alt="Sentry" width="280" height="84">
</a>
</p>

# Official Sentry SDK for Vinext (Experimental)

[![npm version](https://img.shields.io/npm/v/@sentry/vinext.svg)](https://www.npmjs.com/package/@sentry/vinext)
[![npm dm](https://img.shields.io/npm/dm/@sentry/vinext.svg)](https://www.npmjs.com/package/@sentry/vinext)
[![npm dt](https://img.shields.io/npm/dt/@sentry/vinext.svg)](https://www.npmjs.com/package/@sentry/vinext)

> **Warning:** This SDK is experimental and under active development. Breaking changes may occur.

## General

This package is a wrapper around `@sentry/node` for the server and `@sentry/react` for the client side, with added
functionality related to Vinext.
Loading
Loading