Skip to content

Conversation

G-Rath
Copy link

@G-Rath G-Rath commented Oct 9, 2025

Which problem is this PR solving?

  • makes it easier to update packages downstream, since @types/aws-lambda declared a global class so having different versions of the package (regardless of if the class is actually different) in the tree raises an error (see Consider unpinning @types/aws-lambda #2965 for a real-world example of this happening)

Short description of the changes

  • Relaxes the @types/aws-lambda dependency constraint to allow minor and patch versions

Resolves #2965

@G-Rath G-Rath requested a review from a team as a code owner October 9, 2025 20:26
Copy link

linux-foundation-easycla bot commented Oct 9, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: G-Rath / name: Gareth Jones (8fdc030)
  • ✅ login: pichlermarc / name: Marc Pichler (02327de)

@pichlermarc
Copy link
Member

Hmm, I'll leave the decision for this up to @jj22ee.

Personally, I think the better approach to solve this may be to copy the only used type (Context) from this package to @opentelemetry/instrumentation-aws-lambda package instead drop @types/aws-lambda as a dependency instead. That's Option 2 from the Guidelines. That's foregoing Option 1 as it's no longer preferable when a global class definition causes problems.

The type that's actually used is not very simple, but it's simple enough to be copied IMO.

// important: when going this route, retain the original license /**  * MIT License  *  * Copyright (c) Microsoft Corporation.  *  * Permission is hereby granted, free of charge, to any person obtaining a copy  * of this software and associated documentation files (the "Software"), to deal  * in the Software without restriction, including without limitation the rights  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell  * copies of the Software, and to permit persons to whom the Software is  * furnished to do so, subject to the following conditions:  *  * The above copyright notice and this permission notice shall be included in all  * copies or substantial portions of the Software.  *  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE  * SOFTWARE  */ export interface Context { callbackWaitsForEmptyEventLoop: boolean; functionName: string; functionVersion: string; invokedFunctionArn: string; memoryLimitInMB: string; awsRequestId: string; logGroupName: string; logStreamName: string; identity?: { cognitoIdentityId: string; cognitoIdentityPoolId: string; }; clientContext?: { client: { installationId: string; appTitle: string; appVersionName: string; appVersionCode: string; appPackageName: string; }; Custom?: any; env: { platformVersion: string; platform: string; make: string; model: string; locale: string; }; } | undefined; tenantId?: string | undefined; getRemainingTimeInMillis(): number; // Functions for compatibility with earlier Node.js Runtime v0.10.42 // No longer documented, so they are deprecated, but they still work // as of the 12.x runtime, so they are not removed from the types. /** @deprecated Use handler callback or promise result */ done(error?: Error, result?: any): void; /** @deprecated Use handler callback with first argument or reject a promise result */ fail(error: Error | string): void; /** @deprecated Use handler callback with second argument or resolve a promise result */ succeed(messageOrObject: any): void; // Unclear what behavior this is supposed to have, I couldn't find any still extant reference, // and it behaves like the above, ignoring the object parameter. /** @deprecated Use handler callback or promise result */ succeed(message: string, object: any): void; }
Copy link
Member

@pichlermarc pichlermarc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with this as a first step though 🙂

Copy link
Contributor

@jj22ee jj22ee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also fine with this. If you do want to do the "copy the types" approach though, you can refer to this example in aws-sdk instrumentation.

@pichlermarc
Copy link
Member

failing tests are unrelated #3180

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment