Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(solidstart): Add sentrySolidStartVite plugin to simplify sourc… #13563

Closed
wants to merge 28 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
3e32aa4
feat(solidstart): Add `sentrySolidStartVite` plugin to simplify sourc…
andreiborza Sep 3, 2024
25376be
Add vite plugin
andreiborza Sep 3, 2024
5067333
Try exposing to rollup
andreiborza Sep 3, 2024
ebf385a
Try renaming
andreiborza Sep 3, 2024
ee8e5c4
Try using the plugin in the e2e app
andreiborza Sep 3, 2024
117bd3d
Explicit types export
andreiborza Sep 3, 2024
0e5efbc
Try without type import from vite
andreiborza Sep 3, 2024
900d27e
Run only solidstart e2e testapp
andreiborza Sep 3, 2024
5e49caf
Restore plugin type, as it doesn't cause the issue
andreiborza Sep 3, 2024
8d3a6a0
Try removing index export
andreiborza Sep 4, 2024
b51cebd
Add vite folder to package.json
andreiborza Sep 4, 2024
077247a
Add vite as optional peer dep
andreiborza Sep 4, 2024
414d54c
Add PW debug
andreiborza Sep 4, 2024
155f21e
Removing vite export to test
andreiborza Sep 4, 2024
0a5e723
Try with empty plugin
andreiborza Sep 4, 2024
3754de5
Add sentry-vite-plugin
andreiborza Sep 4, 2024
976bf44
Pass vite plugin through
andreiborza Sep 4, 2024
9a7affb
Import but don't use sentry-vite-plugin
andreiborza Sep 4, 2024
4af1cff
Use sentry vite plugin
andreiborza Sep 4, 2024
3f1b1e8
Increase timeout to check
andreiborza Sep 4, 2024
fb30fb3
Fix ci not running tests
andreiborza Sep 4, 2024
54304dc
Add debug plugin
andreiborza Sep 4, 2024
22ec971
Disable telemetry
andreiborza Sep 4, 2024
ec2f04e
Try awaiting...
andreiborza Sep 4, 2024
71bc7f5
Try without hmr
andreiborza Sep 4, 2024
d216e6c
Try marking vite-plugin as external
andreiborza Sep 4, 2024
c0e69bc
Increase timeout...
andreiborza Sep 4, 2024
4e78106
Mark test as slow
andreiborza Sep 4, 2024
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
53 changes: 24 additions & 29 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ jobs:
${{ github.workspace }}/packages/aws-serverless/build/aws/dist-serverless/*.zip

job_browser_unit_tests:
if: false
name: Browser Unit Tests
needs: [job_get_metadata, job_build]
timeout-minutes: 10
Expand Down Expand Up @@ -393,9 +394,10 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}

job_bun_unit_tests:
if: false
name: Bun Unit Tests
needs: [job_get_metadata, job_build]
if: needs.job_build.outputs.changed_bun == 'true' || github.event_name != 'pull_request'
# if: needs.job_build.outputs.changed_bun == 'true' || github.event_name != 'pull_request'
timeout-minutes: 10
runs-on: ubuntu-20.04
strategy:
Expand All @@ -420,9 +422,10 @@ jobs:
yarn test:ci:bun

job_deno_unit_tests:
if: false
name: Deno Unit Tests
needs: [job_get_metadata, job_build]
if: needs.job_build.outputs.changed_deno == 'true' || github.event_name != 'pull_request'
# if: needs.job_build.outputs.changed_deno == 'true' || github.event_name != 'pull_request'
timeout-minutes: 10
runs-on: ubuntu-20.04
strategy:
Expand Down Expand Up @@ -451,6 +454,7 @@ jobs:
yarn test

job_node_unit_tests:
if: false
name: Node (${{ matrix.node }}) Unit Tests
needs: [job_get_metadata, job_build]
timeout-minutes: 10
Expand Down Expand Up @@ -529,9 +533,10 @@ jobs:
run: yarn lerna run test --scope @sentry/profiling-node

job_browser_playwright_tests:
if: false
name: Playwright ${{ matrix.bundle }}${{ matrix.project && matrix.project != 'chromium' && format(' {0}', matrix.project) || ''}}${{ matrix.shard && format(' ({0}/{1})', matrix.shard, matrix.shards) || ''}} Tests
needs: [job_get_metadata, job_build]
if: needs.job_build.outputs.changed_browser_integration == 'true' || github.event_name != 'pull_request'
# if: needs.job_build.outputs.changed_browser_integration == 'true' || github.event_name != 'pull_request'
runs-on: ubuntu-20.04-large-js
timeout-minutes: 25
strategy:
Expand Down Expand Up @@ -611,9 +616,10 @@ jobs:
retention-days: 7

job_browser_loader_tests:
if: false
name: PW ${{ matrix.bundle }} Tests
needs: [job_get_metadata, job_build]
if: needs.job_build.outputs.changed_browser_integration == 'true' || github.event_name != 'pull_request'
# if: needs.job_build.outputs.changed_browser_integration == 'true' || github.event_name != 'pull_request'
runs-on: ubuntu-20.04
timeout-minutes: 15
strategy:
Expand Down Expand Up @@ -688,11 +694,12 @@ jobs:
fi

job_node_integration_tests:
if: false
name:
Node (${{ matrix.node }})${{ (matrix.typescript && format(' (TS {0})', matrix.typescript)) || '' }} Integration
Tests
needs: [job_get_metadata, job_build]
if: needs.job_build.outputs.changed_node_integration == 'true' || github.event_name != 'pull_request'
# if: needs.job_build.outputs.changed_node_integration == 'true' || github.event_name != 'pull_request'
runs-on: ubuntu-20.04
timeout-minutes: 15
strategy:
Expand Down Expand Up @@ -733,9 +740,10 @@ jobs:
run: yarn test

job_remix_integration_tests:
if: false
name: Remix v${{ matrix.remix }} (Node ${{ matrix.node }}) Tests
needs: [job_get_metadata, job_build]
if: needs.job_build.outputs.changed_remix == 'true' || github.event_name != 'pull_request'
# if: needs.job_build.outputs.changed_remix == 'true' || github.event_name != 'pull_request'
runs-on: ubuntu-20.04
timeout-minutes: 10
strategy:
Expand Down Expand Up @@ -859,21 +867,6 @@ jobs:
- ${{ github.actor == 'dependabot[bot]' }}
test-application:
[
'angular-17',
'angular-18',
'astro-4',
'aws-lambda-layer-cjs',
'aws-serverless-esm',
'node-express',
'create-react-app',
'create-next-app',
'create-remix-app',
'create-remix-app-legacy',
'create-remix-app-v2',
'create-remix-app-v2-legacy',
'create-remix-app-express',
'create-remix-app-express-legacy',
'create-remix-app-express-vite-dev',
'default-browser',
'node-express-esm-loader',
'node-express-esm-preload',
Expand Down Expand Up @@ -908,6 +901,7 @@ jobs:
'nestjs-basic',
'nestjs-distributed-tracing',
'nestjs-with-submodules',
'nestjs-with-submodules-decorator',
'nestjs-graphql',
'node-exports-test-app',
'node-koa',
Expand Down Expand Up @@ -1003,6 +997,15 @@ jobs:
timeout-minutes: 5
run: pnpm test:assert

- name: Upload Playwright Traces
uses: actions/upload-artifact@v4
if: failure()
with:
name: playwright-traces-job_e2e_playwright_tests-${{ matrix.test-application}}
path: dev-packages/e2e-tests/test-applications/${{ matrix.test-application}}/test-results
overwrite: true
retention-days: 7

job_optional_e2e_tests:
name: E2E ${{ matrix.label || matrix.test-application }} Test
# We only run E2E tests for non-fork PRs because the E2E tests require secrets to work and they can't be accessed from forks
Expand Down Expand Up @@ -1219,15 +1222,7 @@ jobs:
[
job_build,
job_compile_bindings_profiling_node,
job_browser_unit_tests,
job_bun_unit_tests,
job_deno_unit_tests,
job_node_unit_tests,
job_profiling_node_unit_tests,
job_node_integration_tests,
job_browser_playwright_tests,
job_browser_loader_tests,
job_remix_integration_tests,
job_e2e_tests,
job_profiling_e2e_tests,
job_artifacts,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
import { sentrySolidStartVite } from '@sentry/solidstart';
import { defineConfig } from '@solidjs/start/config';

export default defineConfig({});
export default defineConfig({
vite: {
plugins: [sentrySolidStartVite()],
},
});
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
],
"preview": "HOST=localhost PORT=3030 NODE_OPTIONS='--import ./src/instrument.server.mjs' vinxi dev",
"start": "HOST=localhost PORT=3030 NODE_OPTIONS='--import ./src/instrument.server.mjs' vinxi start",
"test:prod": "TEST_ENV=production playwright test",
"test:prod": "DEBUG=pw:api TEST_ENV=production playwright test",
"test:build": "pnpm install && npx playwright install && pnpm build",
"test:assert": "pnpm test:prod"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { getPlaywrightConfig } from '@sentry-internal/test-utils';
const config = getPlaywrightConfig({
startCommand: 'pnpm preview',
port: 3030,
timeout: 40_000,
});

export default config;
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { expect, test } from '@playwright/test';
import { waitForError } from '@sentry-internal/test-utils';

test('captures an exception', async ({ page }) => {
test.slow();

const errorEventPromise = waitForError('solidstart', errorEvent => {
return (
!errorEvent.type &&
Expand All @@ -10,7 +12,20 @@ test('captures an exception', async ({ page }) => {
);
});

await page.goto('/client-error');
try {
await page.goto('/client-error', {
waitUntil: 'domcontentloaded',
timeout: 25_000,
});
} catch {
// sometimes goto times out, so try again
console.log('page.goto timed out, trying again');
await page.goto('/client-error', {
waitUntil: 'domcontentloaded',
});
}

// await page.goto('/client-error');
await page.locator('#caughtErrorBtn').click();
const errorEvent = await errorEventPromise;

Expand Down
1 change: 1 addition & 0 deletions packages/solidstart/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ module.exports = {
files: ['src/vite/**', 'src/server/**'],
rules: {
'@sentry-internal/sdk/no-optional-chaining': 'off',
'@sentry-internal/sdk/no-nullish-coalescing': 'off',
},
},
],
Expand Down
2 changes: 1 addition & 1 deletion packages/solidstart/rollup.npm.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default makeNPMConfigVariants(
// prevent this internal code from ending up in our built package (this doesn't happen automatially because
// the name doesn't match an SDK dependency)
packageSpecificConfig: {
external: ['solid-js/web', 'solid-js', '@sentry/solid', '@sentry/solid/solidrouter'],
external: ['solid-js/web', 'solid-js', '@sentry/solid', '@sentry/solid/solidrouter', '@sentry/vite-plugin'],
output: {
dynamicImportInCjs: true,
},
Expand Down
1 change: 1 addition & 0 deletions packages/solidstart/src/index.server.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from './server';
export * from './vite';
1 change: 1 addition & 0 deletions packages/solidstart/src/index.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// exports in this file - which we do below.
export * from './client';
export * from './server';
export * from './vite';

import type { Integration, Options, StackParser } from '@sentry/types';

Expand Down
3 changes: 3 additions & 0 deletions packages/solidstart/src/vite/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { sentryVitePlugin } from '@sentry/vite-plugin';

export const sentrySolidStartVite = sentryVitePlugin;
Loading