diff --git a/packages/@aws-cdk/aws-lambda-nodejs/lib/bundling.ts b/packages/@aws-cdk/aws-lambda-nodejs/lib/bundling.ts index 240114fbfa43d..14020859b296d 100644 --- a/packages/@aws-cdk/aws-lambda-nodejs/lib/bundling.ts +++ b/packages/@aws-cdk/aws-lambda-nodejs/lib/bundling.ts @@ -174,7 +174,7 @@ export class Bundling implements cdk.BundlingOptions { osPlatform, }); const environment = this.props.environment ?? {}; - const cwd = path.dirname(this.props.entry); + const cwd = path.dirname(this.props.depsLockFilePath); return { tryBundle(outputDir: string) { diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/bundling.test.ts b/packages/@aws-cdk/aws-lambda-nodejs/test/bundling.test.ts index 5a2549e8fbfc6..45556403d8398 100644 --- a/packages/@aws-cdk/aws-lambda-nodejs/test/bundling.test.ts +++ b/packages/@aws-cdk/aws-lambda-nodejs/test/bundling.test.ts @@ -299,7 +299,7 @@ test('Local bundling', () => { expect.arrayContaining(['-c', expect.stringContaining(entry)]), expect.objectContaining({ env: expect.objectContaining({ KEY: 'value' }), - cwd: '/project/lib', + cwd: '/project', }), );