@rlyle1179/serverless-aws-batch 1.0.24 → 1.0.28

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.
package/lib/batchtask.js CHANGED
@@ -79,7 +79,7 @@ function compileBatchTask(functionName) {
79
79
  timeout: 6,
80
80
  runtime: 'nodejs12.x',
81
81
  package: {
82
- artifact: `${path.join(this.serverless.config.servicePath, '.serverless', functionName)}.zip`
82
+ artifact: `${functionName}.zip`
83
83
  },
84
84
  environment: {
85
85
  EVENT_LOGGING_ENABLED: functionObject.batch.hasOwnProperty('scheduleLoggingEnabled') && functionObject.batch.scheduleLoggingEnabled,
package/lib/schedule.js CHANGED
@@ -36,6 +36,10 @@ module.exports.schedule = (event, context, callback) => {
36
36
 
37
37
  console.log(`Submitting job: ${jobName} with jobDefinition: ${jobDefinition} to queue: ${jobQueue}`);
38
38
 
39
+ // delete headers from the event, we are exceeding the 8092 limit for container overrides
40
+ delete event.headers;
41
+ delete event.multiValueHeaders;
42
+
39
43
  let params = {
40
44
  jobDefinition: jobDefinition,
41
45
  jobName: jobName,
@@ -45,7 +49,6 @@ module.exports.schedule = (event, context, callback) => {
45
49
  },
46
50
  containerOverrides: {
47
51
  environment: [
48
- { name: "_X_AMZN_TRACE_ID", value: process.env._X_AMZN_TRACE_ID },
49
52
  { name: "AWS_LAMBDA_FUNCTION_NAME", value: process.env.AWS_LAMBDA_FUNCTION_NAME },
50
53
  { name: "AWS_LAMBDA_FUNCTION_VERSION", value: process.env.AWS_LAMBDA_FUNCTION_VERSION },
51
54
  { name: "AWS_REQUEST_ID", value: context.awsRequestId }
@@ -56,10 +59,17 @@ module.exports.schedule = (event, context, callback) => {
56
59
  batch.submitJob(params, function(err, data) {
57
60
  let response;
58
61
 
62
+ const jsonHeaders = {
63
+ 'Content-Type': 'application/json',
64
+ 'Access-Control-Allow-Origin': '*', // Required for CORS support to work
65
+ 'Access-Control-Allow-Credentials': true // Required for cookies, authorization headers with HTTPS
66
+ }
67
+
59
68
  if (err) {
60
69
  console.log(`Error submitting job: ${err}`, err.stack);
61
70
  response = {
62
71
  statusCode: 500,
72
+ headers: jsonHeaders,
63
73
  body: JSON.stringify({
64
74
  'error': err
65
75
  })
@@ -69,6 +79,7 @@ module.exports.schedule = (event, context, callback) => {
69
79
  console.log(`Submitted job: ${JSON.stringify(data, null, 2)}`);
70
80
  response = {
71
81
  statusCode: 200,
82
+ headers: jsonHeaders,
72
83
  body: JSON.stringify({
73
84
  data
74
85
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rlyle1179/serverless-aws-batch",
3
- "version": "1.0.24",
3
+ "version": "1.0.28",
4
4
  "description": "Serverless Framework Plugin for interacting with AWS Batch",
5
5
  "main": "index.js",
6
6
  "scripts": {