Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/parser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,6 @@
}
},
"devDependencies": {
"zod": "^4.0.5"
"zod": "^4.0.14"
}
}
30 changes: 29 additions & 1 deletion packages/parser/tests/unit/envelopes/cloudwatch.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ describe('Envelope: CloudWatch', () => {
});
});

it('returns an error if the event is not a valid CloudWatch Logs event', () => {
it('returns an error if the event is not a valid CloudWatch Logs event (invalid base64 passed in the data property)', () => {
// Prepare
const event = {
awslogs: {
Expand All @@ -171,6 +171,34 @@ describe('Envelope: CloudWatch', () => {
path: ['awslogs', 'data'],
message: 'Invalid base64-encoded string',
},
],
}),
}),
originalEvent: event,
});
});

it('returns an error if the event is not a valid CloudWatch Logs event (valid base64 passed but invalid JSON in the payload)', () => {
// Prepare
const event = {
awslogs: {
data: 'eyJ0ZXN0IjoidGVzdCJ9',
},
};

// Act
const result = CloudWatchEnvelope.safeParse(event, z.object({}));

// Assess
expect(result).toEqual({
success: false,
error: expect.objectContaining({
name: 'ParseError',
message: expect.stringContaining(
'Failed to parse CloudWatch Log envelope'
),
cause: expect.objectContaining({
issues: [
{
code: 'custom',
message: 'Failed to decompress CloudWatch log data',
Expand Down
Loading