nodeshift / nodeshift/faas-js-runtime

If fnReturn.body is CloudEvent, we should return CloudEvent's data as response body instead of the whole CloudEvent as response body

Open
#218 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
23
Forks
22
PR merge metrics
No merged PRs in 30d

Description

When we define the response headers in StructuredReturn, the whole CloudEvent is returned as response body instead of the CloudEvent's data.

curl -X POST -d '{"hello": "world"}' \
  -H'Content-type: application/json' \
    -H 'Ce-Id: asdadadsada' \
    -H 'Ce-type: user-request' \
    -H 'Ce-specversion: 1.0' \
    -H 'Ce-correlationid: 123' \
    -H 'Ce-mode: SYNC' \
    -H 'Ce-Source: nodejs' \
    http://localhost:8080

expected: {"hello":"world"}

actual: {"id":"asdadadsada","time":"2023-04-10T03:50:12.135Z","type":"user-request","source":"nodejs","specversion":"1.0","datacontenttype":"application/json","data":{"hello":"world"},"correlationid":"123","mode":"SYNC"}

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with the provided curl request and trace the StructuredReturn response handling in the JavaScript runtime. Done means that when fnReturn.body is a CloudEvent and response headers are defined, the HTTP response body contains the CloudEvent's data rather than the full CloudEvent.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.