actions / deploy-pages

GitHub Action to publish artifacts to GitHub Pages for deployments
https://pages.github.com
MIT License
662 stars 78 forks source link

TypeError: Converting circular structure to JSON #158

Closed SimonSiefke closed 1 year ago

SimonSiefke commented 1 year ago

When the deployment fails, an extra error is logged TypeError: Converting circular structure to JSON.

Run actions/deploy-pages@v1
Artifact exchange URL: https://pipelines.actions.githubusercontent.com/9OtalDJVyLyDdev6inEYQsch43zFDau4CbJSKDrBmMKW7l90L0/_apis/pipelines/workflows/4736187376/artifacts?api-version=6.0-preview
Creating Pages deployment with payload:
{
    "artifact_url": "https://pipelines.actions.githubusercontent.com/9OtalDJVyLyDdev6inEYQsch43zFDau4CbJSKDrBmMKW7l90L0/_apis/pipelines/1/runs/8451/artifacts?artifactName=github-pages&%24expand=SignedContent",
    "pages_build_version": "61bafce1df6a9bf8ae2606d1728980066c6a3817",
    "oidc_token": "***"
}
Error: Creating Pages deployment failed
Error: HttpError: Deployment request failed for 61bafce1df6a9bf8ae2606d1728980066c6a3817 due to in progress deployment. Please cancel 3f30596e81bc4367e96f8af01be23cd080f83ead first or wait for it to complete.
    at /home/runner/work/_actions/actions/deploy-pages/v1/webpack:/deploy-pages/node_modules/@octokit/request/dist-node/index.js:86:1
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at createPagesDeployment (/home/runner/work/_actions/actions/deploy-pages/v1/webpack:/deploy-pages/src/api-client.js:116:1)
    at Deployment.create (/home/runner/work/_actions/actions/deploy-pages/v1/webpack:/deploy-pages/src/deployment.js:58:1)
    at main (/home/runner/work/_actions/actions/deploy-pages/v1/webpack:/deploy-pages/src/index.js:30:1)
Error: TypeError: Converting circular structure to JSON
    --> starting at object with constructor 'TLSSocket'
    |     property '_httpMessage' -> object with constructor 'ClientRequest'
    --- property 'socket' closes the circle

I believe the issue is located here https://github.com/actions/deploy-pages/blob/af48cf94a42f2c634308b1c9dc0151830b6f190a/src/internal/deployment.js#L83 where the function call JSON.stringify(error) fails when the error contains cyclic references.

A possible solution might be to use https://www.npmjs.com/package/serialize-error to remove the cyclic references from the error before passing the result to JSON.stringify.

jlopp commented 1 year ago

Just wanted to note that I'm seeing the same issue with one of my projects at https://github.com/jlopp/bitcoin-transaction-size-calculator/actions/runs/4940715737

codefrau commented 1 year ago

Same error here https://github.com/croquet/worldcore/actions/runs/4941689075

bartvdbraak commented 1 year ago

I am also encountering the same error currently: https://github.com/bartvdbraak/omnidash/actions/runs/5231016740/jobs/9444935459?pr=21

ArthurSonzogni commented 1 year ago

Same error here: https://github.com/ArthurSonzogni/ChromeCommitTracker/actions/runs/5444571261

solderneer commented 1 year ago

Just got the same error as well, not sure how helpful this additional example is šŸ˜… https://github.com/solderneer/solderneer/actions/runs/5444544651/jobs/9903042221

bago commented 1 year ago

Same here now: https://github.com/voidlabs/mosaico.io/actions/runs/5445090273/jobs/9903851393

UPDATE 2023/07/04 it works again.

anibe commented 1 year ago

Can confirm that #197 deploy-pages@v2.0.3 fixes the issue. Thank you @JamesMGreene

abinmn commented 1 year ago

Is it possible to put #197 on v1.x? My enterprise version currently support only v1.x

JamesMGreene commented 1 year ago

@abinmn That's a reasonable request! šŸ‘šŸ»

I've gone ahead and backported #197 (and #187) into a new v1.2.9 release (and the latest v1 tag). Hope that helps. ā¤ļø

abinmn commented 1 year ago

Thanks @JamesMGreene