reg-viz/reg-suit

reg-notify-gitlab-plugin, TypeError: Body is unusable

Sam55555 opened this issue · 1 comments

Describe the bug

reg-notify-gitlab-plugin response error after sending notification. Error only visible after response logging.

Promise { }
[reg-suit] error An error occurs during notify:
[reg-suit] error TypeError: Body is unusable
at specConsumeBody

reg-notify-gitlab-plugin/lib/gitlab-api-client.js:76:24

Error occurred after the update of reg-suit to the latest version with undici.

Reproduced step

Generate report with configured gitlab plugin and add to gitlab client api response logging

Expected behavior

Note with report link created

Actual behavior

There is no note in the gitlab merge request, but report created

mj-hd commented

maybe this error is caused by your logging code because undici does not support reading responses multiple times.

Note: Once a mixin has been called then the body cannot be reused, thus calling additional mixins on .body, e.g. .body.json(); .body.text() will result in an error TypeError: unusable being thrown and returned through the Promise rejection.
https://github.com/nodejs/undici#body-mixins

I guess the actual problem is Gitlab API responds 415 status errors by missing content-type headers.