diff --git a/.changeset/shy-brooms-type.md b/.changeset/shy-brooms-type.md new file mode 100644 index 00000000..f8c4a652 --- /dev/null +++ b/.changeset/shy-brooms-type.md @@ -0,0 +1,5 @@ +--- +'@spotlightjs/core': patch +--- + +Fix PHP Envelopes diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 172ad0d1..6527cfb6 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -2,7 +2,7 @@ module.exports = { root: true, env: { browser: true, es2020: true }, extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'plugin:react-hooks/recommended'], - ignorePatterns: ['dist', '.eslintrc.cjs'], + ignorePatterns: ['dist', '.eslintrc.cjs', '*.test.*'], parser: '@typescript-eslint/parser', plugins: ['react-refresh'], rules: { diff --git a/packages/core/src/integrations/sentry/index.test.ts b/packages/core/src/integrations/sentry/index.test.ts index bad2652d..3c435e70 100644 --- a/packages/core/src/integrations/sentry/index.test.ts +++ b/packages/core/src/integrations/sentry/index.test.ts @@ -18,6 +18,6 @@ describe('Sentry Integration', () => { const envelope = fs.readFileSync('./_fixtures/envelope_php.txt', 'utf-8'); const processedEnvelope = processEnvelope({ data: envelope, contentType: 'test' }); expect(processedEnvelope).not.toBe(undefined); - expect(processedEnvelope.event[1][0][1].type).toEqual('transaction'); + expect((processedEnvelope.event[1][0][1] as any).type).toEqual('transaction'); }); }); diff --git a/packages/core/src/integrations/sentry/index.ts b/packages/core/src/integrations/sentry/index.ts index 3aa6aefb..e8c3bf21 100644 --- a/packages/core/src/integrations/sentry/index.ts +++ b/packages/core/src/integrations/sentry/index.ts @@ -67,13 +67,13 @@ export function processEnvelope({ data }: RawEventContext) { if (!rawEntries[i] || !rawEntries[i + 1]) { continue; } - items.push([JSON.parse(rawEntries[i]), JSON.parse(rawEntries[i + 1])]); - // get type attribute from first and put it into the second - // this is needed because the type is not part of the envelope - // but we need it to determine the severity - if (items[i / 2][0].type) { - items[i / 2][1].type = items[i / 2][0].type; + const header = JSON.parse(rawEntries[i]); + const payload = JSON.parse(rawEntries[i + 1]); + // data sanitization + if (header.type) { + payload.type = header.type; } + items.push([header, payload]); } const envelope = [header, items] as Envelope; diff --git a/packages/website/astro.config.mjs b/packages/website/astro.config.mjs index 6f212fa4..e5a98f51 100644 --- a/packages/website/astro.config.mjs +++ b/packages/website/astro.config.mjs @@ -45,6 +45,33 @@ export default defineConfig({ Hero: './src/components/Hero.astro', Header: './src/components/Header.astro', }, + + head: [ + { + tag: 'meta', + attrs: { property: 'og:image', content: '/images/trace.png' }, + }, + { + tag: 'meta', + attrs: { property: 'twitter:image', content: '/images/trace.png' }, + }, + { + tag: 'meta', + attrs: { + property: 'og:description', + content: + "Spotlight is Sentry for Development. Inspired by an old project, Django Debug Toolbar, Spotlight brings a rich debug overlay into development environments, and it does it by leveraging the existing power of Sentry's SDKs.", + }, + }, + { + tag: 'meta', + attrs: { + property: 'twitter:description', + content: + "Spotlight is Sentry for Development. Inspired by an old project, Django Debug Toolbar, Spotlight brings a rich debug overlay into development environments, and it does it by leveraging the existing power of Sentry's SDKs.", + }, + }, + ], sidebar: [ { label: 'About', diff --git a/packages/website/src/content/docs/about.mdx b/packages/website/src/content/docs/about.mdx index 5ab8f2ab..4f4976d6 100644 --- a/packages/website/src/content/docs/about.mdx +++ b/packages/website/src/content/docs/about.mdx @@ -2,15 +2,6 @@ title: About Spotlight description: "Spotlight is Sentry for Development. Inspired by an old project, Django Debug Toolbar, Spotlight brings a rich debug overlay into development environments, and it does it by leveraging the existing power of Sentry's SDKs." -head: - - tag: meta - attrs: - property: "twitter:card" - content: "product" - - tag: meta - attrs: - property: "og:image" - content: "/images/error.png" sidebar: label: What is Spotlight? order: 0