testcafe-hammerhead: Unhandled promise rejection - Error [ERR_HTTP_TRAILER_INVALID]: Trailers are invalid with this transfer encoding
What 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.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 9
- Comments: 21
Commits related to this issue
- fix `Unhandled promise rejection - Error [ERR_HTTP_TRAILER_INVALID]: Trailers are invalid with this transfer encoding` (close #2692) — committed to LavrovArtem/testcafe-hammerhead by LavrovArtem 3 years ago
- fix `Unhandled promise rejection - Error [ERR_HTTP_TRAILER_INVALID]: Trailers are invalid with this transfer encoding` (close #2692) (#2697) * fix `Unhandled promise rejection - Error [ERR_HTTP_TRAIL... — committed to DevExpress/testcafe-hammerhead by LavrovArtem 3 years ago
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.
This same issue is occurring for me even when using TestCafe v1.16.0 with the
--disable-http2
flag. I also tried using the flag in the testcaferc file and it didn’t help there, either.@JoniVanderheijden Thank you for your workaround. @karimelkomy We cannot give an exact estimate as to when the fix will be released. Please stay tuned.
This is also reproduced for me both:
issue appears on random test runs
+1
I’ve tried updating to v1.15.3 and to v1.16.0, both with the
disableHttp2
option applied, but the error still persists.