Skip to content

Commit

Permalink
Fixes #100
Browse files Browse the repository at this point in the history
  • Loading branch information
HazAT committed Nov 23, 2023
1 parent 4264095 commit d90c89c
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 17 deletions.
5 changes: 5 additions & 0 deletions .changeset/shy-brooms-type.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@spotlightjs/core': patch
---

Fix PHP Envelopes
2 changes: 1 addition & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/integrations/sentry/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});
});
12 changes: 6 additions & 6 deletions packages/core/src/integrations/sentry/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
27 changes: 27 additions & 0 deletions packages/website/astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
9 changes: 0 additions & 9 deletions packages/website/src/content/docs/about.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d90c89c

Please sign in to comment.