Serverless-offline: Error - internal, implementation, error

Created on 31 Mar 2016  路  28Comments  路  Source: dherault/serverless-offline

Debug: internal, implementation, error
    TypeError: response.send is not a function
  at Offline._reply500 (E:\wamp\www\project\node_modules\serverless-offline\src\index.js:470:16)
  at server.route.handler.Object.keys.forEach.createLambdaContext (E:\wamp\www\project\node_modules\serverless-offline\src\index.js:444:29)
  at Object.exports.execute.internals.prerequisites.internals.handler.callback [as handler] (E:\wamp\www\project\node_modules\serverless-offline\node_modules\hapi\lib\handler.js:96:36)
  at E:\wamp\www\project\node_modules\serverless-offline\node_modules\hapi\lib\handler.js:30:23
  at [object Object].internals.Protect.run.finish [as run] (E:\wamp\www\project\node_modules\serverless-offline\node_modules\hapi\lib\protect.js:64:5)
  at exports.execute.finalize (E:\wamp\www\project\node_modules\serverless-offline\node_modules\hapi\lib\handler.js:24:22)
  at each (E:\wamp\www\project\node_modules\serverless-offline\node_modules\hapi\lib\request.js:383:16)
  at iterate (E:\wamp\www\project\node_modules\serverless-offline\node_modules\hapi\node_modules\items\lib\index.js:36:13)
  at done (E:\wamp\www\project\node_modules\serverless-offline\node_modules\hapi\node_modules\items\lib\index.js:28:25)
  at [object Object].internals.Auth.test.internals.Auth._authenticate (E:\wamp\www\project\node_modules\serverless-offline\node_modules\hapi\lib\auth.js:210:16)
  at internals.Auth.test.internals.Auth.authenticate (E:\wamp\www\project\node_modules\serverless-offline\node_modules\hapi\lib\auth.js:202:17)
  at each (E:\wamp\www\project\node_modules\serverless-offline\node_modules\hapi\lib\request.js:383:16)
  at iterate (E:\wamp\www\project\node_modules\serverless-offline\node_modules\hapi\node_modules\items\lib\index.js:36:13)
  at done (E:\wamp\www\project\node_modules\serverless-offline\node_modules\hapi\node_modules\items\lib\index.js:28:25)
  at internals.state.next (E:\wamp\www\project\node_modules\serverless-offline\node_modules\hapi\lib\route.js:350:16)
  at each (E:\wamp\www\project\node_modules\serverless-offline\node_modules\hapi\lib\request.js:383:16)
  at iterate (E:\wamp\www\project\node_modules\serverless-offline\node_modules\hapi\node_modules\items\lib\index.js:36:13)
  at Object.exports.serial (E:\wamp\www\project\node_modules\serverless-offline\node_modules\hapi\node_modules\items\lib\index.js:39:9)
  at [object Object].internals.Request.internals.Request._execute.internals.Request._lifecycle.each [as _lifecycle] (E:\wamp\www\project\node_modules\serverless-offline\node_modules\hapi\lib\request.js:386:11)
  at [object Object].internals.Request.internals.Request._execute (E:\wamp\www\project\node_modules\serverless-offline\node_modules\hapi\lib\request.js:301:21)
  at Domain.<anonymous> (E:\wamp\www\project\node_modules\serverless-offline\node_modules\hapi\lib\connection.js:244:25)
  at Domain.run (domain.js:228:14)
  at [object Object].internals.Protect.run.internals.Protect.enter (E:\wamp\www\project\node_modules\serverless-offline\node_modules\hapi\lib\protect.js:80:17)
  at Server.<anonymous> (E:\wamp\www\project\node_modules\serverless-offline\node_modules\hapi\lib\connection.js:242:30)
  at emitTwo (events.js:87:13)
  at Server.emit (events.js:172:7)
  at HTTPParser.parserOnIncoming [as onIncoming] (_http_server.js:528:12)
  at HTTPParser.parserOnHeadersComplete (_http_common.js:88:23)

can you please explain why i am getting this error,is this bug or i have issue with my code

i love your work :)

Most helpful comment

Thanks for hard work ! your plugin is essential for serverless framework cant imagine work without your plugin :+1:

All 28 comments

Just for ref - i have created common function for response,i have pass content as param of common function and return like content.done in common function

module.exports.response= function(context,status,data){
return context.done(null, {
        message: 'Go Serverless! Your Lambda function executed successfully!'
    });
}

without common function offline works fine !

Hello @nirmalgoswami
Can you provide more details about your project (especially your handler and s-function file)?
Do you think it has to do with the order of args ? context,status,data

YES! I found the issue ^^ it has to do with the plugin u_u, will fix soon

Sorry to disturb you for that, but can you copy/paste me the line at E:\wamp\www\project\node_modulesserverless-offlinesrcindex.js:444 ? Thanks

@dherault here it is line number 444

return this._reply500(response, 'Uncaught error in your handler', err);

thanks

welcome :+1:

OMG, are you using the babel runtime?

no

This is bigger than I thought, it will take me some time. you should try to install a previous version of the plugin in the meanwhile
npm uninstall serverless-offline
npm install [email protected]

no problem take your time

Done! Please try v2.2.2
You may still have an error though, but I hope it won't be mine :stuck_out_tongue:
Thanks a lot @nirmalgoswami for pointing this out

@dherault Thanks for such fast fix :) let me check

@dherault Fixed :+1: :100:

Wooooouoooo :fire: :exclamation: 'till next bug :stuck_out_tongue:

can you please explain case when this type of error can come

you have mentioned that You may still have an error though, but I hope it won't be mine

before fixed this issue,i got this error on first run of function on browser,,but that fixed but i got another error related mysql,,i mean may be due to timeout of mysql connection,i got after some idle time

i got following error

Debug: internal, implementation, error
    TypeError: response.send is not a function
  at Object.done (E:\wamp\www\project\node_modules\serverless-offline\src\index.js:479:26)
  at Object.module.exports.apiResponse (E:\wamp\www\project\api\lib\index.js:18:20)
  at callback (E:\wamp\www\project\api\user\userEvent\handler.js:35:11)
  at Query.<anonymous> (E:\wamp\www\project\api\user\userEvent\handler.js:398:13)
  at bound (domain.js:287:14)
  at Query.runBound [as _callback] (domain.js:300:12)
  at Query.Sequence.end (E:\wamp\www\project\api\node_modules\mysql\lib\protocol\sequences\Sequence.js:96:24)
  at Query._handleFinalResultPacket (E:\wamp\www\project\api\node_modules\mysql\lib\protocol\sequences\Query.js:144:8)
  at Query.EofPacket (E:\wamp\www\project\api\node_modules\mysql\lib\protocol\sequences\Query.js:128:8)
  at Protocol._parsePacket (E:\wamp\www\project\api\node_modules\mysql\lib\protocol\Protocol.js:280:23)
  at Parser.write (E:\wamp\www\project\api\node_modules\mysql\lib\protocol\Parser.js:73:12)
  at Protocol.write (E:\wamp\www\project\api\node_modules\mysql\lib\protocol\Protocol.js:39:16)
  at Socket.<anonymous> (E:\wamp\www\project\api\node_modules\mysql\lib\Connection.js:96:28)
  at emitOne (events.js:77:13)
  at Socket.emit (events.js:169:7)
  at readableAddChunk (_stream_readable.js:146:16)
  at Socket.Readable.push (_stream_readable.js:110:10)
  at TCP.onread (net.js:523:20)

Damn, I'll look again u_u after I eat

This time I really need some code, can you send me your project by email ([email protected]) unless it's confidential of course. Thanks!

@dherault i can not give you project due to confidential issue but if you want to see my project structure then here it is project-structure

Ok, let us do things differently:
can you run sls offline start [your usual options] --debugOffline and copy/paste te console output please? I really can't find what causes this bug.

Mmm I found something. Do you call context.(done/succeed/fail) twice ?

hahahha yes i am also debugging,,,look like this is case....i did not use return false

return false ? I don't see why your handler should return anything in particular

So,
once again, v2.2.3 should (and may) fix it. Thanks for your help @nirmalgoswami the plugin got nicer.

Thanks for consider my point in plugin

please work little more on Warning: context.done called twice! because its hard to find where is mistake,it is just showing Warning: context.done called twice! message,it should be display line number to trace issue,this is my suggestion.

Ok it's noted! I'm currently working on a new version of the plugin, with support for python runtime, I'll include this as well. Watch out for version 2.3 :)

Including the line number might be possible, I'll look deeper into that.

Thanks for hard work ! your plugin is essential for serverless framework cant imagine work without your plugin :+1:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

aldofunes picture aldofunes  路  3Comments

yareyaredesuyo picture yareyaredesuyo  路  4Comments

FranzSkuffka picture FranzSkuffka  路  3Comments

Dong9769 picture Dong9769  路  4Comments

ghost picture ghost  路  4Comments