Skip to content

The value is only accessible if the object's 'responseType' is '' or 'text' (was 'json') #244

Closed

Description

@alankyshum

Error log

Uncaught DOMException: Failed to read the 'responseText' property from 'XMLHttpRequest': The value is only accessible if the object's 'responseType' is '' or 'text' (was 'json').

As suggested from the error log, foo.responseText was called, but foo.responseType === json.

How to reproduce?

This should happen whenever REQUEST_ASYNC === true && request.readyState === 4

https://github.com/kategengler/ember-cli-code-coverage/blob/046e445b47e4a5da0aa5ea4d27380d9288cbedd0/lib/templates/test-body-footer.html#L22-L29

Reason

https://github.com/kategengler/ember-cli-code-coverage/blob/046e445b47e4a5da0aa5ea4d27380d9288cbedd0/lib/templates/test-body-footer.html#L53-L56

When responseType === 'json', the handleCoverageResponse is still called and xhr.responseText would cause an error, and halt the whole test.

ok 138 Chrome 80.0 - [0 ms] - ember-qunit: Ember.onerror validation: Ember.onerror is functioning properly

Manual stack trace

Function that handles the /write-coverage and sends the data without response property

https://github.com/kategengler/ember-cli-code-coverage/blob/d6e2262923e7caeeb383fb6ccdf7b46e227f5715/lib/attach-middleware.js#L75-L78

Function that creates the data sent as a response

https://github.com/kategengler/ember-cli-code-coverage/blob/d6e2262923e7caeeb383fb6ccdf7b46e227f5715/lib/attach-middleware.js#L57

Activity

  1. brokenalarms commented on May 20, 2020

    @brokenalarms
    Contributor

    Yes! This has been causing flakiness in our build pipeline for some time, but we have not been able to reproduce it locally.

  2. added a commit that references this issue on May 22, 2020
    8803463
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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