user3634184
user3634184

Reputation: 466

.StartExecution is not a function

I have created a lambda (so far so good).

Specifications:

But when I try to invoke a step function from my lambda like this:

var AWS = require("aws-sdk");
var stepfunctions = new AWS.StepFunctions({apiVersion: '2016-11-23'});
const params = {
  "input": "{}",
  "name": srcKey,
  "stateMachineArn": process.env.STATE_MACHINE_ARN
};

return stepfunctions.StartExecution(params);

I get the following error:

Response
{
  "errorType": "TypeError",
  "errorMessage": "stepfunctions.StartExecution is not a function",
  "trace": [
    "TypeError: stepfunctions.StartExecution is not a function",
    "    at /var/task/index.js:119:26",
    "    at wrapper (/var/task/node_modules/async/dist/async.js:273:20)",
    "    at Response.next (/var/task/node_modules/async/dist/async.js:4585:24)",
    "    at Response.<anonymous> (/var/task/node_modules/async/dist/async.js:326:20)",
    "    at Request.<anonymous> (/var/runtime/node_modules/aws-sdk/lib/request.js:369:18)",
    "    at Request.callListeners (/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:106:20)",
    "    at Request.emit (/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:78:10)",
    "    at Request.emit (/var/runtime/node_modules/aws-sdk/lib/request.js:688:14)",
    "    at Request.transition (/var/runtime/node_modules/aws-sdk/lib/request.js:22:10)",
    "    at AcceptorStateMachine.runTo (/var/runtime/node_modules/aws-sdk/lib/state_machine.js:14:12)"
  ]
}

Which makes no sense to me?

If I see this documentation: https://docs.aws.amazon.com/step-functions/latest/apireference/API_StartExecution.html And even this one: https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/StepFunctions.html#constructor-property

The function should be available there.

What am I missing / doing wrong?

Thanks!

Upvotes: 1

Views: 624

Answers (1)

brianz
brianz

Reputation: 7448

You have a typo...it's a lowercase s:

startExecution vs StartExecution

https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/StepFunctions.html#startExecution-property

Upvotes: 2

Related Questions