Skip to content

Commit da93637

Browse files
authored
Merge branch 'master' into njlynch/cf-domains
2 parents 780006e + bb90fbe commit da93637

File tree

5 files changed

+25
-4
lines changed

5 files changed

+25
-4
lines changed

CHANGELOG.md

-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ All notable changes to this project will be documented in this file. See [standa
3636

3737
* **cloudwatch:** alarm status widget ([#9456](https://github.com/aws/aws-cdk/issues/9456)) ([41940d3](https://github.com/aws/aws-cdk/commit/41940d3cfad289cbaed8ff60a21c6c9fa9aad532))
3838
* **cognito:** better control sms role creation ([#9513](https://github.com/aws/aws-cdk/issues/9513)) ([a772fe8](https://github.com/aws/aws-cdk/commit/a772fe84784e62843ef724a9158fc8cda848c5c9)), closes [#6943](https://github.com/aws/aws-cdk/issues/6943)
39-
* **core:** deprecate "Construct.node" in favor of "Construct.construct" ([#9557](https://github.com/aws/aws-cdk/issues/9557)) ([aa4c5b7](https://github.com/aws/aws-cdk/commit/aa4c5b7df3a4880638361026ec0f6a77b7476b40)), closes [/github.com/aws/aws-cdk-rfcs/blob/master/text/0192-remove-constructs-compat.md#10](https://github.com/aws//github.com/aws/aws-cdk-rfcs/blob/master/text/0192-remove-constructs-compat.md/issues/10)
4039
* **core:** local bundling provider ([#9564](https://github.com/aws/aws-cdk/issues/9564)) ([3da0aa9](https://github.com/aws/aws-cdk/commit/3da0aa99d16e908a39f43f463ac2889dd232c611))
4140
* **core:** new annotations api ([#9563](https://github.com/aws/aws-cdk/issues/9563)) ([ae9ed62](https://github.com/aws/aws-cdk/commit/ae9ed6208dc81a7a38f4b9626c7c30f1811f97a9)), closes [/github.com/aws/aws-cdk-rfcs/blob/master/text/0192-remove-constructs-compat.md#09](https://github.com/aws/aws-cdk-rfcs/blob/master/text/0192-remove-constructs-compat.md#09-logging-logging-api-changes)
4241
* **core:** new APIs for Aspects and Tags ([#9558](https://github.com/aws/aws-cdk/issues/9558)) ([a311428](https://github.com/aws/aws-cdk/commit/a311428d6013a1486585979a010f4105b0e0f97a)), closes [/github.com/aws/aws-cdk-rfcs/blob/master/text/0192-remove-constructs-compat.md#02](https://github.com/aws/aws-cdk-rfcs/blob/master/text/0192-remove-constructs-compat.md#02-aspects-changes-in-aspects-api)

packages/@aws-cdk/aws-lambda-nodejs/lib/bundling.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ export class Bundling {
168168
// Always rename dist file to index.js because Lambda doesn't support filenames
169169
// with multiple dots and we can end up with multiple dots when using automatic
170170
// entry lookup
171-
`mv ${cdk.AssetStaging.BUNDLING_OUTPUT_DIR}/${distFile} ${cdk.AssetStaging.BUNDLING_OUTPUT_DIR}/index.js`,
171+
distFile !== 'index.js' ? `mv ${cdk.AssetStaging.BUNDLING_OUTPUT_DIR}/${distFile} ${cdk.AssetStaging.BUNDLING_OUTPUT_DIR}/index.js` : '',
172172
]);
173173

174174
let installer = Installer.NPM;

packages/@aws-cdk/aws-lambda-nodejs/test/bundling.test.ts

+19
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,25 @@ test('Parcel bundling', () => {
7474
expect(findUpMock).toHaveBeenCalledWith('package.json', '/project/folder');
7575
});
7676

77+
test('Parcel bundling with handler named index.ts', () => {
78+
Bundling.parcel({
79+
entry: '/project/folder/index.ts',
80+
runtime: Runtime.NODEJS_12_X,
81+
projectRoot: '/project',
82+
});
83+
84+
// Correctly bundles with parcel
85+
expect(Code.fromAsset).toHaveBeenCalledWith('/project', {
86+
assetHashType: AssetHashType.BUNDLE,
87+
bundling: expect.objectContaining({
88+
command: [
89+
'bash', '-c',
90+
'$(node -p "require.resolve(\'parcel\')") build /asset-input/folder/index.ts --target cdk-lambda --dist-dir /asset-output --no-autoinstall --no-scope-hoist',
91+
],
92+
}),
93+
});
94+
});
95+
7796
test('Parcel with Windows paths', () => {
7897
Bundling.parcel({
7998
entry: 'C:\\my-project\\lib\\entry.ts',

packages/@aws-cdk/aws-lambda/lib/function.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as cloudwatch from '@aws-cdk/aws-cloudwatch';
2-
import { IProfilingGroup, ProfilingGroup } from '@aws-cdk/aws-codeguruprofiler';
2+
import { IProfilingGroup, ProfilingGroup, ComputePlatform } from '@aws-cdk/aws-codeguruprofiler';
33
import * as ec2 from '@aws-cdk/aws-ec2';
44
import * as iam from '@aws-cdk/aws-iam';
55
import * as logs from '@aws-cdk/aws-logs';
@@ -572,7 +572,9 @@ export class Function extends FunctionBase {
572572
};
573573
} else if (props.profiling) {
574574
this.validateProfilingEnvironmentVariables(props);
575-
const profilingGroup = new ProfilingGroup(this, 'ProfilingGroup');
575+
const profilingGroup = new ProfilingGroup(this, 'ProfilingGroup', {
576+
computePlatform: ComputePlatform.AWS_LAMBDA,
577+
});
576578
profilingGroup.grantPublish(this.role);
577579
profilingGroupEnvironmentVariables = {
578580
AWS_CODEGURU_PROFILER_GROUP_ARN: profilingGroup.profilingGroupArn,

packages/@aws-cdk/aws-lambda/test/test.function.ts

+1
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ export = testCase({
197197

198198
expect(stack).to(haveResource('AWS::CodeGuruProfiler::ProfilingGroup', {
199199
ProfilingGroupName: 'MyLambdaProfilingGroupC5B6CCD8',
200+
ComputePlatform: 'AWSLambda',
200201
}));
201202

202203
expect(stack).to(haveResource('AWS::IAM::Policy', {

0 commit comments

Comments
 (0)