Strider-CD / strider-gitlab

Seamless integration between Strider and GitLab
25 stars 16 forks source link

Cannot read property 'page' of undefined #115

Closed selfagency closed 2 years ago

selfagency commented 4 years ago

After activating the GitLab plugin (v1.2.3), adding my credentials, and attempting to view my GitLab repositories on the Projects tab, the application crashes with the following error:

3|strider  | 2020-04-30T03:46:02.914Z - error: TypeError: Cannot read property 'page' of undefined
3|strider  |     at /var/www/strider/node_modules/strider-gitlab/lib/api.js:61:67
3|strider  |     at Request.callback (/var/www/strider/node_modules/strider-gitlab/node_modules/superagent/lib/node/index.js:591:12)
3|strider  |     at /var/www/strider/node_modules/strider-gitlab/node_modules/superagent/lib/node/index.js:766:18
3|strider  |     at Stream.<anonymous> (/var/www/strider/node_modules/strider-gitlab/node_modules/superagent/lib/node/parsers/json.js:16:7)
3|strider  |     at Stream.emit (events.js:322:22)
3|strider  |     at Unzip.<anonymous> (/var/www/strider/node_modules/strider-gitlab/node_modules/superagent/lib/node/utils.js:108:12)
3|strider  |     at Unzip.emit (events.js:322:22)
3|strider  |     at endReadableNT (_stream_readable.js:1187:12)
3|strider  |     at processTicksAndRejections (internal/process/task_queues.js:84:21)
3|strider  | 17821 died 1 null
selfagency commented 4 years ago

So after poking around, it appears that the GitLab API is not returning the rel=last tag in the Link header, which I assume is an error on their end which I'll open a ticket up about. However, they're also providing the necessary information in a different set of headers:

X-Next-Page: 2
X-Page: 1
X-Per-Page: 20
X-Prev-Page:
selfagency commented 4 years ago

Here's the GitLab issue https://gitlab.com/gitlab-org/gitlab/-/issues/216218

knownasilya commented 4 years ago

Thanks for digging in! I'll make sure to have a look. Feel free to submit a PR if you have time.

knownasilya commented 4 years ago

Released a fix to at least get the first page.

knownasilya commented 4 years ago

Really this should have a search. I added an option in the gitlab setup config that lets you limit projects to ones you are a member of. Live in strider v2.4.0.

knownasilya commented 4 years ago

Looks like https://docs.gitlab.com/ee/api/README.html#other-pagination-headers (see bottom alert section) might be the problem.

selfagency commented 4 years ago

GitLab responded and indeed you are correct https://gitlab.com/gitlab-org/gitlab/-/issues/216218#note_336682734

selfagency commented 2 years ago

closing this because it's 2 years old, this project appears to be defunct, and i want to clean up my issues tab