Unhandled promise rejection - Error [ERR_HTTP_TRAILER_INVALID]: Trailers are invalid with this transfer encoding
See original GitHub issueWhat is your Scenario?
We have a whole test suite that began failing this weekend, due to an unhandled promise rejection - ERR_HTTP_TRAILER_INVALID error. The tests previously were passing for quite some time, running against headless Chromium browser.
What is the Current behavior?
The tests, intermittently, are making it all the way to the end of the test and then fail on closing, with the following error:
1) Unhandled promise rejection:
Error [ERR_HTTP_TRAILER_INVALID]: Trailers are invalid with this transfer encoding
at ServerResponse._storeHeader (_http_outgoing.js:445:11)
at ServerResponse.writeHead (_http_server.js:312:8)
at RequestPipelineContext.sendResponseHeaders (/Volumes/casesensitive/git/mc_testcafe/node_modules/testcafe-hammerhead/lib/request-pipeline/context.js:319:13)
at Array.sendProxyResponse (/Volumes/casesensitive/git/mc_testcafe/node_modules/testcafe-hammerhead/lib/request-pipeline/stages.js:129:13)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at Object.run (/Volumes/casesensitive/git/mc_testcafe/node_modules/testcafe-hammerhead/lib/request-pipeline/index.js:19:9)
What is the Expected behavior?
Tests pass consistently.
What is your public web site URL?
Your website URL (or attach your complete example):
Your complete app code (or attach your test files):
This is a simple test as an example:
import {Selector, t} from "testcafe";
const username = Selector("#username");
const password = Selector("#password");
const btnLogin = Selector("button[value='log in']");
const recoverPwdMsg = Selector("div[class='feedback-block error section']");
async function login(user, pwd) {
await t
.typeText(username, user)
.typeText(password, pwd)
.click(btnLogin);
}
fixture`Mailchimp User Signin Tests`;
test.page`https://mailchimp.com/login`(
"Signin with invalid user credentials: Invalid User: @login",
async t => {
await t.expect(username.exists).ok();
await login("abc12345!", "abc12345!");
await t.expect(recoverPwdMsg.exists).ok();
}
);
Screenshots:
Steps to Reproduce:
- Go to: https://mailchimp.com/login
- Execute this command: Enter invalid credentials and click login
- See the error: Test steps and assertions complete successfully but test reports failure due to unhandled promise rejection.
Your Environment details:
- node.js version: v14.17.2
- browser name and version: Chrome 92.0.4479.0 (92.0.4515.159 / Linux 0.0 in Jenkins)
- platform and version: macOS 10.15.7 (as well as Linux in Jenkins)
- other: Have been using Testcafe 1.14.2. Issue also seen on 1.15.0. Unable to upgrade to latest Testcafe version due to outstanding iframe issues.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:9
- Comments:21
Top Results From Across the Web
Error [ERR_HTTP_TRAILER_INVALID]: Trailers are invalid ...
Error [ERR_HTTP_TRAILER_INVALID]: Trailers are invalid with this transfer encoding at ServerResponse._storeHeader (_http_outgoing.js:424:11) ...
Read more >using trailer header with http chunked transfer. How to set ...
Using trailer I am trying to set a cookie after the page streaming has started. the code below tries to set the cookie....
Read more >Trailers are invalid with this transfer encoding - Bountysource
Error [ERR_HTTP_TRAILER_INVALID]: Trailers are invalid with this transfer encoding at ServerResponse._storeHeader (_http_outgoing.js:424:11)
Read more >The Node.js API
11.3.16 NODE TLS REJECT UNAUTHORIZED=value . ... 15.2.18 DEP0018 Unhandled promise rejections. ... 19.11.76 ERR HTTP TRAILER INVALID.
Read more >Node.js response.addTrailers() Method - GeeksforGeeks
Trailers will only be emitted if the chunked encoding is used for the response; if it is not (e.g. if the request was...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
If you’re one of those poor sods pulling this issue in through Testcafe and aren’t against using patch-package. This is the patch file that fixed it for us until testcafe pulls in the fix.
/patches/testcafe++testcafe-hammerhead+24.5.1.patch
Thank you all for the information. We will research it and update this thread once we have any news.