Serverless-offline: SyntaxError: Uncaught error: Unexpected end of input on Empty POST body

Created on 16 Aug 2016  路  9Comments  路  Source: dherault/serverless-offline

When POSTing to an endpoint with an empty body and header the following error occurs:

Debug: internal, implementation, error
SyntaxError: Uncaught error: Unexpected end of input
at Object.parse (native)
at authFunctions.server.route.handler.createLambdaContext (.../node_modules/serverless-offline/src/index.js:378:40)
at Object.exports.execute.internals.prerequisites.internals.handler.callback as handler
at .../node_modules/hapi/lib/handler.js:30:23
at [object Object].internals.Protect.run.finish as run
at exports.execute.finalize (.../node_modules/hapi/lib/handler.js:24:22)
at each (.../node_modules/hapi/lib/request.js:383:16)
at iterate (.../node_modules/items/lib/index.js:36:13)
at done (.../node_modules/items/lib/index.js:28:25)
at internals.Auth.test.internals.Auth.payload.finalize (.../node_modules/hapi/lib/auth.js:223:16)
at each (.../node_modules/hapi/lib/request.js:383:16)
at iterate (.../node_modules/items/lib/index.js:36:13)
at done (.../node_modules/items/lib/index.js:28:25)
at onParsed (.../node_modules/hapi/lib/route.js:402:20)
at .../node_modules/hapi/lib/route.js:423:20
at next (.../node_modules/subtext/lib/index.js:43:16)
at .../node_modules/subtext/lib/index.js:232:16
at finish (.../node_modules/wreck/lib/index.js:328:20)
at wrapped (.../node_modules/wreck/node_modules/hoek/lib/index.js:871:20)
at [object Object].onReaderFinish (.../node_modules/wreck/lib/index.js:399:16)
at [object Object].g (events.js:260:16)
at emitNone (events.js:72:20)
at [object Object].emit (events.js:166:7)
at finishMaybe (_stream_writable.js:478:14)
at endWritable (_stream_writable.js:488:3)
at [object Object].Writable.end (_stream_writable.js:453:5)
at IncomingMessage.onend (_stream_readable.js:498:10)
at IncomingMessage.g (events.js:260:16)
at emitNone (events.js:72:20)
at IncomingMessage.emit (events.js:166:7)
at endReadableNT (_stream_readable.js:913:12)
at nextTickCallbackWith2Args (node.js:442:9)
at process._tickDomainCallback (node.js:397:17)

bug needs tests

Most helpful comment

This message is still appearing in 3.25.4

All 9 comments

Thanks @zachmanpro . Is it fixed now? v2.8.1

Installed 2.8.1 and it's throwing this error now.

TypeError: Uncaught error: contentTypesThatRequirePayloadParsing.includes is not a function

.includes isn't consistently supported in node without the harmony flag. Possible to use indexOf instead?

same here

Sorry guys, I thought everyone would be es6 friendly by now u_u. I'll use a good old es5 technique instead. v2.8.2

Sorry for late reply - yes its seems so ;-)

This message is still appearing in 3.25.4

This message is still appearing in 4.6.0

@dev-bandai I cannot reproduce in 4.6.0, can you give me your failing request please ?

just tried to repro. this seems to work as intended. closing.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

adambiggs picture adambiggs  路  4Comments

Rafaelsk picture Rafaelsk  路  4Comments

aldofunes picture aldofunes  路  3Comments

dnalborczyk picture dnalborczyk  路  3Comments

stonebraker picture stonebraker  路  3Comments