-
Notifications
You must be signed in to change notification settings - Fork 71
Closed
Labels
module/libRelated to the main source codeRelated to the main source codemodule/transport/httpIssues related to the HTTP transport protocol implementationIssues related to the HTTP transport protocol implementationtype/bugSomething isn't workingSomething isn't working
Description
Describe the Bug
When calling emitterFor()
, if you provide an option, as in the README example, it will fail. Example:
const emit = emitterFor(sendWithAxios, { binding: HTTP });
Produces the failure message:
(node:2623360) UnhandledPromiseRejectionWarning: TypeError: Unexpected transport mode: undefined
at emit (/home/lanceball/src/github.com/lance/ce/node_modules/cloudevents/dist/transport/emitter.js:41:23)
at Function.<anonymous> (/home/lanceball/src/github.com/lance/ce/node_modules/cloudevents/dist/transport/emitter.js:96:87)
at Generator.next (<anonymous>)
at /home/lanceball/src/github.com/lance/ce/node_modules/cloudevents/dist/transport/emitter.js:8:71
at new Promise (<anonymous>)
at __awaiter (/home/lanceball/src/github.com/lance/ce/node_modules/cloudevents/dist/transport/emitter.js:4:12)
at /home/lanceball/src/github.com/lance/ce/node_modules/cloudevents/dist/transport/emitter.js:96:33
at Array.map (<anonymous>)
at Function.<anonymous> (/home/lanceball/src/github.com/lance/ce/node_modules/cloudevents/dist/transport/emitter.js:96:22)
at Generator.next (<anonymous>)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:2623360) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:2623360) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
This is because the defaults are dropped when a parameter is provided here:
sdk-javascript/src/transport/emitter.ts
Line 48 in 39812f7
const { binding, mode } = options; |
Steps to Reproduce
- Copy one of the
emitterFor()
examples into anindex.js
file. - Create a local process that can receive CloudEvents and change the URL in the example code to point to this
- Install axios and cloudevents modules locally
- Run
node index.js
Expected Behavior
The event viewer process should receive the event and respond with a success code. Instead, we don't get that far because of failure. In fact, you don't even really need step 2 above, since the failure occurs before a request is made.
Metadata
Metadata
Assignees
Labels
module/libRelated to the main source codeRelated to the main source codemodule/transport/httpIssues related to the HTTP transport protocol implementationIssues related to the HTTP transport protocol implementationtype/bugSomething isn't workingSomething isn't working