Skip to content

Commit 490b3df

Browse files
authored
chore: fixed lambda name (#12815)
1 parent 007e994 commit 490b3df

File tree

2 files changed

+46
-1
lines changed

2 files changed

+46
-1
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import {
2+
addFunction,
3+
amplifyPushAuth,
4+
createNewProjectDir,
5+
deleteProject,
6+
deleteProjectDir,
7+
generateRandomShortId,
8+
initJSProjectWithProfile,
9+
loadFunctionTestFile,
10+
overrideFunctionSrcNode,
11+
} from '@aws-amplify/amplify-e2e-core';
12+
import { v4 as uuid } from 'uuid';
13+
14+
describe('amplify push function cases:', () => {
15+
let projRoot: string;
16+
17+
beforeEach(async () => {
18+
projRoot = await createNewProjectDir('multiple-function-push');
19+
});
20+
21+
afterEach(async () => {
22+
await deleteProject(projRoot);
23+
deleteProjectDir(projRoot);
24+
});
25+
26+
it('should be able to push multiple functions at the same time', async () => {
27+
const projName = `multilambda${generateRandomShortId()}`;
28+
await initJSProjectWithProfile(projRoot, { name: projName });
29+
30+
const [shortId] = uuid().split('-');
31+
const functionName = `nodetestfunction${shortId}`;
32+
33+
await addFunction(projRoot, { functionTemplate: 'Hello World', name: functionName }, 'nodejs');
34+
await amplifyPushAuth(projRoot);
35+
36+
const functionCode = loadFunctionTestFile('case-function.js').replace('{{testString}}', 'Hello from Lambda!');
37+
overrideFunctionSrcNode(projRoot, functionName, functionCode);
38+
await addFunction(projRoot, { functionTemplate: 'Hello World' }, 'python');
39+
40+
await amplifyPushAuth(projRoot);
41+
});
42+
});

packages/amplify-provider-awscloudformation/src/push-resources.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,10 @@ export const updateStackForAPIMigration = async (context: $TSContext, category:
564564

565565
const prepareBuildableResources = async (context: $TSContext, resources: $TSAny[]): Promise<void> => {
566566
// Only build and package resources which are required
567-
await Promise.all(resources.filter((resource) => resource.build).map((resource) => prepareResource(context, resource)));
567+
const resourcesToBuild = resources.filter((resource) => resource.build);
568+
for (const resource of resourcesToBuild) {
569+
await prepareResource(context, resource);
570+
}
568571
};
569572

570573
const prepareResource = async (context: $TSContext, resource: $TSAny) => {

0 commit comments

Comments
 (0)