Skip to content

[🐛 Bug]: Unexpected token on failing request with HTML response. Is not retrying the request #14759

@Nyaran

Description

@Nyaran

Have you read the Contributing Guidelines on issues?

WebdriverIO Version

9.19.2

Node.js Version

22.18.0

Mode

WDIO Testrunner

Which capabilities are you using?

{
    browserName: 'chrome'
}

What happened?

Running tests using our Selenium server, which is behind a nginx server, sometimes we are getting HTTP 504 Gateway time-out error. And as that kind of errors by default are replied with an HTML page with the error itself, is causing another error on WebdriverIO while parsing the response:

Unexpected token '<', "
<he"... is not valid JSON when running

That errors avoids the retry system, causing the entire test fail.

What is your expected behavior?

The request should be retried as it happens with other request failures

How to reproduce the bug.

Is a private server so I can grant anyone access, by it should be easily to reproduce with a simple mock, as the one purposed here: #2521 (comment)

Relevant log output

Unexpected token '<', "<html>
<he"... is not valid JSON when running

Code of Conduct

  • I agree to follow this project's Code of Conduct

Is there an existing issue for this?

  • I have searched the existing issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions