scientific-python / circleci-artifacts-redirector-action

GitHub Action to add a GitHub status link to a CircleCI artifact.
MIT License
14 stars 8 forks source link

Error: Cannot read properties of undefined (reading 'length') #38

Closed rcomer closed 1 year ago

rcomer commented 1 year ago

Hi, the workflow has started failing today with the above error. The same error shows in Matplotlib and Cartopy https://github.com/matplotlib/matplotlib/actions/runs/4450306863/jobs/7815604256 https://github.com/SciTools/cartopy/actions/runs/4448260418/jobs/7810837269

Any ideas?

Thanks!

larsoner commented 1 year ago

We have debug enabled for MNE-Python which helps:

https://github.com/mne-tools/mne-python/actions/runs/4450717175/jobs/7816511325

##[debug]18:57:10 GMT+0000 (Coordinated Universal Time)
##[debug]Considering CircleCI jobs named: ci/circleci: build_docs,ci/circleci: build_docs_main
##[debug]context:    ci/circleci: build_docs
##[debug]state:      pending
##[debug]target_url: https://circleci.com/gh/mne-tools/mne-python/53315
##[debug]org:   mne-tools
##[debug]repo:  mne-python
##[debug]build: 53315
##[debug]Fetching JSON: https://circleci.com/api/v2/project/gh/mne-tools/mne-python/53[31](https://github.com/mne-tools/mne-python/actions/runs/4450717175/jobs/7816511325#step:2:32)5/artifacts
##[debug]Successfully read CircleCI API token
##[debug]Artifacts JSON:
##[debug]{"message":"Bad request."}
Error: Cannot read properties of undefined (reading 'length')

suggests the error happens here:

https://github.com/larsoner/circleci-artifacts-redirector-action/blob/590e7142d7dc855dabe2e9225fa4a5694b76b7cb/index.js#L56-L62

But we don't have any API token in use over there so something is wrong with the parsing. I'll see if it's an easy fix...

larsoner commented 1 year ago

Actually I think it's the "fetching json" step. That URL is wrong. Looking at this run:

https://github.com/mne-tools/mne-python/actions/runs/4440303062/jobs/7793929609

We had:

##[debug]Fetching JSON: https://circleci.com/api/v2/project/gh/mne-tools/mne-python/53275/artifacts
rcomer commented 1 year ago

Thanks for the speedy fix @larsoner!