Skip to content

ref(aws-serverless): Use debug instead of logger #17030

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

Merged
merged 1 commit into from
Jul 16, 2025
Merged
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
14 changes: 7 additions & 7 deletions packages/aws-serverless/src/sdk.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Integration, Options, Scope, Span } from '@sentry/core';
import {
applySdkMetadata,
logger,
debug,
SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,
SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,
} from '@sentry/core';
Expand Down Expand Up @@ -127,7 +127,7 @@ export function tryPatchHandler(taskRoot: string, handlerPath: string): void {
const handlerDesc = basename(handlerPath);
const match = handlerDesc.match(/^([^.]*)\.(.*)$/);
if (!match) {
DEBUG_BUILD && logger.error(`Bad handler ${handlerDesc}`);
DEBUG_BUILD && debug.error(`Bad handler ${handlerDesc}`);
return;
}

Expand All @@ -138,7 +138,7 @@ export function tryPatchHandler(taskRoot: string, handlerPath: string): void {
const handlerDir = handlerPath.substring(0, handlerPath.indexOf(handlerDesc));
obj = tryRequire(taskRoot, handlerDir, handlerMod);
} catch (e) {
DEBUG_BUILD && logger.error(`Cannot require ${handlerPath} in ${taskRoot}`, e);
DEBUG_BUILD && debug.error(`Cannot require ${handlerPath} in ${taskRoot}`, e);
return;
}

Expand All @@ -150,17 +150,17 @@ export function tryPatchHandler(taskRoot: string, handlerPath: string): void {
functionName = name;
});
if (!obj) {
DEBUG_BUILD && logger.error(`${handlerPath} is undefined or not exported`);
DEBUG_BUILD && debug.error(`${handlerPath} is undefined or not exported`);
return;
}
if (typeof obj !== 'function') {
DEBUG_BUILD && logger.error(`${handlerPath} is not a function`);
DEBUG_BUILD && debug.error(`${handlerPath} is not a function`);
return;
}

// Check for prototype pollution
if (functionName === '__proto__' || functionName === 'constructor' || functionName === 'prototype') {
DEBUG_BUILD && logger.error(`Invalid handler name: ${functionName}`);
DEBUG_BUILD && debug.error(`Invalid handler name: ${functionName}`);
return;
}

Expand Down Expand Up @@ -317,7 +317,7 @@ export function wrapHandler<TEvent, TResult>(
span.end();
}
await flush(options.flushTimeout).catch(e => {
DEBUG_BUILD && logger.error(e);
DEBUG_BUILD && debug.error(e);
});
}
return rv;
Expand Down
Loading