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

context.succeed is not a function #50

Closed
StoneCypher opened this issue Jan 17, 2016 · 5 comments
Closed

context.succeed is not a function #50

StoneCypher opened this issue Jan 17, 2016 · 5 comments

Comments

@StoneCypher
Copy link

context.succeed( {test:'foo'} ); is a valid JSON endpoint response under lambda. However, under node-lambda, one instead receives (admittedly this is an svg, not the string foo):

$ ./node_modules/node-lambda/bin/node-lambda run
Running index.handler
==================================
event { key: 'value', key2: 'value2', other_key: 'other_value' }
context { done: [Function] }
==================================
Stopping index.handler
c:\projects\node-lambda-template\index.js:11
  context.succeed( {test:'<svg xmlns="http://www.w3.org/2000/svg" width="500" height="500"><g transform="translate(250,250)"><path class="arc" d="M-14
1.06846055019358,-194.16407864998737A240,240 0 0,1 -4.408728476930471e-14,-240L0,0Z" fill="#5da5da" stroke="#000"></path><path class="arc" d="M-228.25
356391083685,74.1640786499874A240,240 0 0,1 -141.06846055019358,-194.16407864998737L0,0Z" fill="#faa43a" stroke="#000"></path><path class="arc" d="M14
1.06846055019355,194.1640786499874A240,240 0 0,1 -228.25356391083685,74.1640786499874L0,0Z" fill="#60bd68" stroke="#000"></path><path class="arc" d="M
1.469576158976824e-14,-240A240,240 0 0,1 141.06846055019355,194.1640786499874L0,0Z" fill="#b2912f" stroke="#000"></path></g></svg>'} );
          ^

TypeError: context.succeed is not a function
    at exports.handler (c:\projects\node-lambda-template\index.js:11:11)
    at Lambda._runHandler (c:\projects\node-lambda-template\node_modules\node-lambda\lib\main.js:71:3)
    at Lambda.run (c:\projects\node-lambda-template\node_modules\node-lambda\lib\main.js:61:8)
    at Command.<anonymous> (c:\projects\node-lambda-template\node_modules\node-lambda\bin\node-lambda:51:12)
    at Command.listener (c:\projects\node-lambda-template\node_modules\commander\index.js:301:8)
    at emitTwo (events.js:87:13)
    at Command.emit (events.js:172:7)
    at Command.parseArgs (c:\projects\node-lambda-template\node_modules\commander\index.js:615:12)
    at Command.parse (c:\projects\node-lambda-template\node_modules\commander\index.js:458:21)
    at Object.<anonymous> (c:\projects\node-lambda-template\node_modules\node-lambda\bin\node-lambda:64:9)

Am I misusing something?

@dilab
Copy link

dilab commented Jan 23, 2016

Seeing the same error message.

It seems like context does not have implement succeed and fail method.

@coagmano
Copy link

coagmano commented Feb 4, 2016

context does implement succeed and fail though: code. And it works just fine for me.

What version of node-lambda are you running?

@StoneCypher
Copy link
Author

i exited lambda because i was unable to make it work on the required timeline

sorry :(

@lancefisher
Copy link

This is an issue with https://github.com/motdotla/node-lambda-template

If you are starting with that, it uses an out-of-date version of node-lambda.

In package.json try changing:

  "dependencies": {
    "node-lambda": "0.1.5"
  }

to

  "devDependencies": {
    "node-lambda": "^0.7.1"
  }

Then, be sure to update your packages:

rm -rf node_modules
npm install

StoneCypher added a commit to StoneCypher/node-lambda-template that referenced this issue Feb 9, 2016
@StoneCypher
Copy link
Author

er. right you are, @lancefisher.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants