Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getConfigFile() throws error instead of returning emptyConfigResult when file does not exist #257

Open
andy-crain-kr opened this issue Jun 19, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@andy-crain-kr
Copy link

What happened?

When a specified file does not exist, getConfigFile() is supposed to return an emptyConfigResult object. But when the non-existent file is requested, octokit.request throws an error that has {...status: "404" }, while getConfigFile() is anticipating 404 (integer) instead of "404" (string), and so instead of returning emptyConfigResult, it instead throws the error.

What did you expect to happen?

I would expect that when a file does not exist, an emptyConfigResult object is returned.

What the problem might be

The test:

    if (error.status === 404) {
      return emptyConfigResult;
    }

should instead be:

    if (error.status === "404") {
      return emptyConfigResult;
    }
@andy-crain-kr andy-crain-kr added the bug Something isn't working label Jun 19, 2024
@wolfy1339
Copy link
Contributor

wolfy1339 commented Jul 21, 2024

Can you provide details on your environment? It seems that in some environments, like Google Cloud Functions, status codes are returned as strings

According to the spec, status codes are supposed to be integers

@Uzlopak
Copy link
Contributor

Uzlopak commented Jul 21, 2024

@andy-crain-kr

Do you use gcf?

@andy-crain-kr
Copy link
Author

@wolfy1339, @Uzlopak, no this is in a self-hosted kubernetes cluster.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants