Skip to content

[bug] curling a nodejs function produces: "TypeError: Cannot read property 'info' of undefined" #194

@alanfx

Description

@alanfx

Describe the bug
Created a nodejs function, ran it locally, and curling the loclhost:8080 endpoint produces an error.

To Reproduce
Steps to reproduce the behavior:

  1. kn faas init -l node
  2. npm run local
  3. curl -X POST -d '{"hello": "world"}' -H'Content-type: application/json' -H'Ce-id: 1' -H'Ce-source: cloud-event-example' -H'Ce-type: dev.knative.example' -H'Ce-specversion: 1.0' http://localhost:8080

Result: {"statusMessage":"Cannot read property 'info' of undefined"}

TypeError: Cannot read property 'info' of undefined
    at invoke (/home/afield/Development/go/bin/func1/index.js:30:15)
    at invokeFunction (/home/afield/.npm/_npx/1178569/lib/node_modules/faas-js-runtime/lib/invoker.js:21:34)
    at Object.doPost (/home/afield/.npm/_npx/1178569/lib/node_modules/faas-js-runtime/lib/request-handler.js:18:28)
    at preHandlerCallback (/home/afield/.npm/_npx/1178569/lib/node_modules/faas-js-runtime/node_modules/fastify/lib/handleRequest.js:124:28)
    at next (/home/afield/.npm/_npx/1178569/lib/node_modules/faas-js-runtime/node_modules/fastify/lib/hooks.js:158:7)
    at Object.<anonymous> (/home/afield/.npm/_npx/1178569/lib/node_modules/faas-js-runtime/lib/event-handler.js:26:5)
    at hookIterator (/home/afield/.npm/_npx/1178569/lib/node_modules/faas-js-runtime/node_modules/fastify/lib/hooks.js:221:10)
    at next (/home/afield/.npm/_npx/1178569/lib/node_modules/faas-js-runtime/node_modules/fastify/lib/hooks.js:162:20)
    at Object.<anonymous> (/home/afield/.npm/_npx/1178569/lib/node_modules/faas-js-runtime/index.js:32:5)
    at hookIterator (/home/afield/.npm/_npx/1178569/lib/node_modules/faas-js-runtime/node_modules/fastify/lib/hooks.js:221:10)

Expected behavior
The CloudEvent is delivered to the function without error.

Metadata

Metadata

Assignees

Labels

kind/bugCategorizes issue or PR as related to a bug.templates/nodeRelated to the Node.js function templates

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions