Skip to content

Commit

Permalink
fix ts errors
Browse files Browse the repository at this point in the history
  • Loading branch information
NimrodAvni78 committed Jun 6, 2024
1 parent b33f969 commit 7fe85ac
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
3 changes: 3 additions & 0 deletions nodejs/packages/cx-wrapper/aws/aws-user-function.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import {Handler} from "aws-lambda/handler";

export function load(taskRoot?: string, originalHandler?: string): Handler;
12 changes: 4 additions & 8 deletions nodejs/packages/cx-wrapper/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { load } from './aws/aws-user-function.js';
import {
Callback,
Context,
Handler,
} from 'aws-lambda';

import { AwsLambdaInstrumentation } from '@opentelemetry/instrumentation-aws-lambda';
Expand All @@ -12,15 +11,12 @@ import {
defaultTextMapGetter,
Context as OtelContext,
diag,
DiagConsoleLogger,
DiagLogLevel,
propagation,
Span,
trace,
metrics,
} from '@opentelemetry/api';

import { AwsLambdaInstrumentationConfig } from '@opentelemetry/instrumentation-aws-lambda';
import {Handler} from "aws-lambda/handler";

const parseIntEnvvar = (envName: string): number | undefined => {
const envVar = process.env?.[envName];
Expand All @@ -30,7 +26,7 @@ const parseIntEnvvar = (envName: string): number | undefined => {
return numericEnvvar;
};

const RPC_REQUEST_PAYLOAD: 'rpc.request.payload';
const RPC_REQUEST_PAYLOAD = 'rpc.request.payload';
const DEFAULT_OTEL_PAYLOAD_SIZE_LIMIT = 50 * 1024;
const OTEL_PAYLOAD_SIZE_LIMIT: number =
parseIntEnvvar('OTEL_PAYLOAD_SIZE_LIMIT') ?? DEFAULT_OTEL_PAYLOAD_SIZE_LIMIT;
Expand Down Expand Up @@ -115,6 +111,6 @@ export const handler = async (event: any, context: Context, callback: Callback)
process.env.CX_ORIGINAL_HANDLER
);

const patchedHandler = instrumentation.getPatchHandler(originalHandler)
const patchedHandler = instrumentation.getPatchHandler(originalHandler) as any as Handler;
patchedHandler(event, context, callback)
}
}

0 comments on commit 7fe85ac

Please sign in to comment.