Skip to content

Cryptic error when a snapshot is too large #4

@jaller94

Description

@jaller94

const { uploaded } = JSON.parse(body); // body is json

For the line above the API (/build/upload/snapshot) responded with a non-JSON answer.

My HTML snapshot was 1.530.769 bytes large, because the CSS was inserted inline.

Error

SyntaxError: Unexpected token < in JSON at position 0
    at JSON.parse (<anonymous>)
    at Client.uploadSnapshot (/home/jaller94/Git/kiprotect/kiprotect-app/node_modules/@getbasset/node-client/lib/client.js:87:31)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at Basset.uploadSnapshotFile (/home/jaller94/Git/kiprotect/kiprotect-app/node_modules/@getbasset/node-client/lib/basset.js:71:5)

Code submitting the snapshots

export BASSET_APP_URL=https://app.basset.io
export BASSET_TOKEN=*REDACTED*

My upload code is copied from this file:
https://github.com/basset/basset/blob/200088fe30353c0eeedfb1e824c9ac8a38e92aa2/express/tests/selenium/config/snapshots.js#L68-L88

Actual network response

With the HTTP code 413 I got the following response:

<html>
<head><title>413 Request Entity Too Large</title></head>
<body>
<center><h1>413 Request Entity Too Large</h1></center>
<hr><center>openresty/1.15.8.2</center>
</body>
</html>

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