Skip to content
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

fix(lambda-nodejs): handler filename missing from error message #14564

Merged
merged 5 commits into from
May 11, 2021
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-lambda-nodejs/lib/function.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ function findEntry(id: string, entry?: string): string {
return jsHandlerFile;
}

throw new Error('Cannot find entry file.');
throw new Error(`Cannot find handler file ${tsHandlerFile} or ${jsHandlerFile}`);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-lambda-nodejs/test/function.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ test('throws when entry does not exist', () => {
});

test('throws when entry cannot be automatically found', () => {
expect(() => new NodejsFunction(stack, 'Fn')).toThrow(/Cannot find entry file./);
expect(() => new NodejsFunction(stack, 'Fn')).toThrow(/Cannot find handler file.*function\.test\.Fn\.js/);
Copy link
Contributor

Choose a reason for hiding this comment

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

Where is the typescript part?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added in the next commit.

});

test('throws with the wrong runtime family', () => {
Expand Down