@rlyle1179/serverless-aws-batch 1.1.7 → 1.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/batchtask.js +15 -1
  2. package/package.json +1 -1
package/lib/batchtask.js CHANGED
@@ -27,6 +27,8 @@ function getBatchJobExecutionRoleLogicalId(functionName) {
27
27
  : logicalId;
28
28
  }
29
29
 
30
+ let dependsOnFunction = undefined;
31
+
30
32
  /**
31
33
  * Transforms a function object into a "JobDefinition" object that can be used to run this function inside a Batch task
32
34
  */
@@ -54,14 +56,26 @@ function compileBatchTask(functionName) {
54
56
  updateRetryStrategy.bind(this)(newFunction, functionObject);
55
57
  updateTimeout.bind(this)(newFunction, functionObject);
56
58
 
59
+ const logicalId = getJobDefinitionLogicalId(functionName);
60
+
57
61
  // generate role for a batchjob execution based on custom iam statements
58
62
  const newBatchJobExecutionRoleObject = generateBatchJobExecutionRole.bind(this)(functionName, functionObject)
59
63
 
64
+ // FIX: CloudFormation is blowing up trying to create all the JobDefinitions in parallel,
65
+ // so to fix we make each JobDefinition depend on the prior one being created to solve this issue.
66
+ if ( dependsOnFunction !== undefined ) {
67
+ for(let k in newBatchJobExecutionRoleObject) {
68
+ newBatchJobExecutionRoleObject[k]["DependsOn"] = dependsOnFunction;
69
+ }
70
+ newFunction["DependsOn"] = dependsOnFunction;
71
+ }
72
+ dependsOnFunction = logicalId;
73
+
60
74
  // Add it to our compiled cloud formation templates
61
75
  _.merge(
62
76
  this.serverless.service.provider.compiledCloudFormationTemplate.Resources,
63
77
  {
64
- [getJobDefinitionLogicalId(functionName)]: newFunction
78
+ [logicalId]: newFunction
65
79
  },
66
80
  newBatchJobExecutionRoleObject
67
81
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rlyle1179/serverless-aws-batch",
3
- "version": "1.1.7",
3
+ "version": "1.1.11",
4
4
  "description": "Serverless Framework Plugin for interacting with AWS Batch",
5
5
  "main": "index.js",
6
6
  "scripts": {