Skip to content

Javascript error: unsafe member access services/agent-service.js #515

@Dmitry9

Description

@Dmitry9

There is a javascript error during execution of the services/agent-service.js.

It happens when request.body.domSnapshot is not a typeof Array or String.

Screenshot from 2020-05-28 13-01-20
Please can this line:
https://github.com/percy/percy-agent/blob/master/src/services/agent-service.ts#L82

if (domSnapshotLog.length > Constants.MAX_LOG_LENGTH) {

be changed to something like:

if (domSnapshotLog && domSnapshotLog.length > constants_1.default.MAX_LOG_LENGTH) {

Same goes for:
https://github.com/percy/percy-agent/blob/master/src/services/agent-service.ts#L120

if (domSnapshot.length > constants_1.default.MAX_FILE_SIZE_BYTES) {

to

if (domSnapshot && domSnapshot.length > constants_1.default.MAX_FILE_SIZE_BYTES) {

@djones djones FYI

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions