Describe the bug
.get() does not return the data for a GitLab private repository. It works perfectly fine & returns data for public GitLab projects though.
Example code that doesn't work
const gitrows = new GitRows({
token: "xxxxxxxxxxxx", // a valid gitlab access token with api access to the project
});
const results = await gitrows.get("@gitlab/owner/reponame/path/to/data.json");
console.log(results) // null
Example code that works
const gitrows = new GitRows({
server: "git.nomics.world"
});
const results = await gitrows.get("@gitlab/dbnomics-json-data/oecd-json-data/ADIMA/dataset.json");
console.log(results) // logs the correct data
To Reproduce
Steps to reproduce the behavior:
- Create a private repository in gitlab.com with a JSON data file in it
- Create a personal access token with
api access
- Configure a new GitRows instance with the token
- Make a
.get() call by supplying a correctly formed url
Expected behavior
The promise returned by .get() resolves to null. It should resolve to an object having the same data as exists in the repo .json file.
Additional context
Upon some debugging, I found that the response returned for the network request contains the full HTML payload, as if the request is being made by a browser. The code tries to parse HTML code as JSON which obviously fails and is caught accordingly thereby returning null. This is happening most likely because the network request URL that is supposed to fetch the data doesn't contain the token anywhere in its URL or headers. The GItLab host is not able to authenticate & thus responds with HTML payload for its login page.
Describe the bug
.get()does not return the data for a GitLab private repository. It works perfectly fine & returns data for public GitLab projects though.Example code that doesn't work
Example code that works
To Reproduce
Steps to reproduce the behavior:
apiaccess.get()call by supplying a correctly formed urlExpected behavior
The promise returned by
.get()resolves tonull. It should resolve to an object having the same data as exists in the repo .json file.Additional context
Upon some debugging, I found that the response returned for the network request contains the full HTML payload, as if the request is being made by a browser. The code tries to parse HTML code as JSON which obviously fails and is caught accordingly thereby returning
null. This is happening most likely because the network request URL that is supposed to fetch the data doesn't contain the token anywhere in its URL or headers. The GItLab host is not able to authenticate & thus responds with HTML payload for its login page.