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: bundle latest SDK in branch linker lambda #562

Merged
merged 3 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
5 changes: 5 additions & 0 deletions .changeset/warm-spoons-cheer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@aws-amplify/backend': patch
---

bundle AWS SDK in branch linker lambda
2 changes: 2 additions & 0 deletions .eslint_dictionary.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
"appleid",
"appsync",
"argv",
"arn",
"arns",
"bundler",
"cdk",
"changelog",
"changeset",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ export class AmplifyBranchLinkerConstruct extends Construct {
timeout: Duration.seconds(10),
entry: linkerLambdaFilePath,
handler: 'handler',
bundling: {
// TODO Remove it when Lambda serves SDK 3.440.0+
// https://github.com/aws-amplify/samsara-cli/issues/561
// This is added to force bundler to include local version of AWS SDK.
// Lambda provided version does not have 'backend.stackArn' yet.
externalModules: [],
},
});

linkerLambda.grantPrincipal.addToPrincipalPolicy(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@
"S3Bucket": {
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
},
"S3Key": "98bdeb476c46210a30ee3b8365a50fd0d1e761f483b4908f725362ba64d23c59.zip"
"S3Key": "2194a3b7d50443cf7f4b1eeb75ed230d4beb1ce0f73ccf994e6d15317c79a378.zip"
},
"Environment": {
"Variables": {
Expand Down
36 changes: 17 additions & 19 deletions packages/integration-tests/src/test-e2e/deployment.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,25 +48,23 @@ void describe('amplify deploys', async () => {
void it(`[${testProject.name}] deploys fully`, async () => {
await testProject.deploy(branchBackendIdentifier);
await testProject.assertPostDeployment();
// TODO enable these assertions when stackArn round trips from service.
// https://github.com/aws-amplify/samsara-cli/issues/554
// const testBranchDetails = await amplifyAppPool.fetchTestBranchDetails(
// testBranch
// );
// assert.ok(
// testBranchDetails.backend?.stackArn,
// 'branch should have stack associated'
// );
// assert.ok(
// testBranchDetails.backend?.stackArn?.includes(
// branchBackendIdentifier.backendId
// )
// );
// assert.ok(
// testBranchDetails.backend?.stackArn?.includes(
// branchBackendIdentifier.disambiguator
// )
// );
const testBranchDetails = await amplifyAppPool.fetchTestBranchDetails(
testBranch
);
assert.ok(
testBranchDetails.backend?.stackArn,
'branch should have stack associated'
);
assert.ok(
testBranchDetails.backend?.stackArn?.includes(
branchBackendIdentifier.backendId
)
);
assert.ok(
testBranchDetails.backend?.stackArn?.includes(
branchBackendIdentifier.disambiguator
)
);
});
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@
"S3Bucket": {
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
},
"S3Key": "98bdeb476c46210a30ee3b8365a50fd0d1e761f483b4908f725362ba64d23c59.zip"
"S3Key": "2194a3b7d50443cf7f4b1eeb75ed230d4beb1ce0f73ccf994e6d15317c79a378.zip"
},
"Environment": {
"Variables": {
Expand Down Expand Up @@ -394,7 +394,7 @@
{
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
},
"/b1588ca380e76e80f240eed7acba3e7a58ddb8612e8b5e4e8cb698500255ca4e.json"
"/bffb1190157cfb84fe69186893f7e380119cc5b0d4680095958149d37f8dfd52.json"
]
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@
"backendId": "testAppId",
"branchName": "testBranchName",
"secretName": "testAmazonId",
"secretLastUpdated": 1698951292560
"secretLastUpdated": 1698959044636
},
"UpdateReplacePolicy": "Delete",
"DeletionPolicy": "Delete"
Expand All @@ -222,7 +222,7 @@
"backendId": "testAppId",
"branchName": "testBranchName",
"secretName": "testAmazonSecret",
"secretLastUpdated": 1698951292560
"secretLastUpdated": 1698959044636
},
"UpdateReplacePolicy": "Delete",
"DeletionPolicy": "Delete"
Expand All @@ -239,7 +239,7 @@
"backendId": "testAppId",
"branchName": "testBranchName",
"secretName": "testFacebookId",
"secretLastUpdated": 1698951292560
"secretLastUpdated": 1698959044636
},
"UpdateReplacePolicy": "Delete",
"DeletionPolicy": "Delete"
Expand All @@ -256,7 +256,7 @@
"backendId": "testAppId",
"branchName": "testBranchName",
"secretName": "testFacebookSecret",
"secretLastUpdated": 1698951292561
"secretLastUpdated": 1698959044636
},
"UpdateReplacePolicy": "Delete",
"DeletionPolicy": "Delete"
Expand All @@ -273,7 +273,7 @@
"backendId": "testAppId",
"branchName": "testBranchName",
"secretName": "testGoogleId",
"secretLastUpdated": 1698951292561
"secretLastUpdated": 1698959044636
},
"UpdateReplacePolicy": "Delete",
"DeletionPolicy": "Delete"
Expand All @@ -290,7 +290,7 @@
"backendId": "testAppId",
"branchName": "testBranchName",
"secretName": "testGoogleSecret",
"secretLastUpdated": 1698951292561
"secretLastUpdated": 1698959044636
},
"UpdateReplacePolicy": "Delete",
"DeletionPolicy": "Delete"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
"S3Bucket": {
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
},
"S3Key": "98bdeb476c46210a30ee3b8365a50fd0d1e761f483b4908f725362ba64d23c59.zip"
"S3Key": "2194a3b7d50443cf7f4b1eeb75ed230d4beb1ce0f73ccf994e6d15317c79a378.zip"
},
"Environment": {
"Variables": {
Expand Down
Loading