Skip to content

[BUG]: Unexpected end of JSON input #649

@tsusdere

Description

@tsusdere

What happened?

Getting an empty response data results in HttpError: invalid json response body when attempting to convert the response to json:

if (/application\/json/.test(contentType!)) {
return response.json();
}

Versions

Octokit v8.1.4

Relevant log output


### What happened?

Getting an empty response data results in `HttpError: invalid json response body` when attempting to convert the response to json:

https://github.com/octokit/request.js/blob/5c1fcdfa07f087bffe86bff3c84c9855b744de5b/src/fetch-wrapper.ts#L155-L157

### Versions

Octokit v8.1.4

### Relevant log output

##[debug]Evaluating condition for step: 'Deploy to GitHub Pages'
2##[debug]Evaluating: success()
3##[debug]Evaluating success:
4##[debug]=> true
5##[debug]Result: true
6##[debug]Starting: Deploy to GitHub Pages
7##[debug]Loading inputs
8##[debug]Evaluating: github.token
9##[debug]Evaluating Index:
10##[debug]..Evaluating github:
11##[debug]..=> Object
12##[debug]..Evaluating String:
13##[debug]..=> 'token'
14##[debug]=> '***'
15##[debug]Result: '***'
16##[debug]Loading env
17
Run actions/deploy-pages@v1.2.9
18  with:
19    emit_telemetry: false
20    token: ***
21    timeout: 600000
22    error_count: 10
23    reporting_interval: 5000
24    artifact_name: github-pages
25    preview: false
26##[debug]all variables are set
27##[debug]all variables are set
28##[debug]ID token url is https://[REDACTED]/_services/pipelines/eRhS9LBtNTGin3wENmb093bx6wzbQ19LimyrpKukvyqgYmqa0d/00000000-0000-0000-0000-000000000000/_apis/distributedtask/hubs/Actions/plans/399052e0-ae3b-4207-bd94-d869210658b3/jobs/e07742bd-189a-5079-918b-43f8b2f94b89/idtoken?api-version=2.0
29::add-mask::***
30##[debug]Actor: nilsw
31##[debug]Action ID: deployment
32##[debug]Actions Workflow Run ID: 98423
33##[debug]all variables are set
34Artifact exchange URL: https://[REDACTED]/_services/pipelines/eRhS9LBtNTGin3wENmb093bx6wzbQ19LimyrpKukvyqgYmqa0d/_apis/pipelines/workflows/98423/artifacts?api-version=6.0-preview
35##[debug]{"count":1,"value":[{"containerId":240179,"size":10240,"signedContent":null,"fileContainerResourceUrl":"https://[REDACTED]/_services/pipelines/eRhS9LBtNTGin3wENmb093bx6wzbQ19LimyrpKukvyqgYmqa0d/_apis/resources/Containers/240179","type":"actions_storage","name":"github-pages","url":"https://[REDACTED]/_services/pipelines/eRhS9LBtNTGin3wENmb093bx6wzbQ19LimyrpKukvyqgYmqa0d/_apis/pipelines/1/runs/4/artifacts?artifactName=github-pages","expiresOn":"2023-10-26T19:25:29.6207174Z","items":null}]}
36Creating Pages deployment with payload:
37{
38 "artifact_url": "https://[REDACTED]/_services/pipelines/eRhS9LBtNTGin3wENmb093bx6wzbQ19LimyrpKukvyqgYmqa0d/_apis/pipelines/1/runs/4/artifacts?artifactName=github-pages&%24expand=SignedContent",
39 "pages_build_version": "0fbfbe3039ef54252a8d6af01dec3d3020463a67",
40 "oidc_token": "***"
41}
42
Error:
Creating Pages deployment failed
43
Error:
HttpError: invalid json response body at https://[REDACTED]/api/v3/repos/security/sfdb-debug/pages/deployment reason: Unexpected end of JSON input
44    at /scratch/ghe-runners/2/_work/_actions/actions/deploy-pages/v1.2.9/webpack:/deploy-pages/node_modules/@octokit/request/dist-node/index.js:108:1
45    at processTicksAndRejections (node:internal/process/task_queues:96:5)
46    at createPagesDeployment (/scratch/ghe-runners/2/_work/_actions/actions/deploy-pages/v1.2.9/webpack:/deploy-pages/src/api-client.js:116:1)
47    at Deployment.create (/scratch/ghe-runners/2/_work/_actions/actions/deploy-pages/v1.2.9/webpack:/deploy-pages/src/deployment.js:59:1)
48    at main (/scratch/ghe-runners/2/_work/_actions/actions/deploy-pages/v1.2.9/webpack:/deploy-pages/src/index.js:30:1)
49
Error:
HttpError: invalid json response body at https://[REDACTED]/api/v3/repos/security/sfdb-debug/pages/deployment reason: Unexpected end of JSON input
50##[debug]Node Action run completed with exit code 1
51##[debug]Finishing: Deploy to GitHub Pages

Code of Conduct

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: BugSomething isn't working as documentedreleased

    Type

    No type

    Projects

    Status

    ✅ Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions