Commit 2017ed6
authored
Fix misleading error message when using an expired GITHUB_TOKEN (#2568)
## Summary
Currently when if `GITHUB_TOKEN` is set to an expired or invalid token
requests to github will fail with a 404. There is not messaging to the
user (even with `DEVBOX_DEBUG=1`) to indicate the cause. This took a
while to debug, opening this PR to make it easier for the next person
this happens to.
## How was it tested?
- make a temp devbox project and add a plugin like
https://github.com/jetify-com/devbox-plugins/tree/main/mongodb
- set `GITHUB_TOKEN` to a random string
- see the following error that doesn't indicate the cause of the error
at all (also try running with `DEVBOX_DEBUG=1` and see no extra helpful
info
```
❯ devbox install
Error: failed to get plugin github:jetpack-io/devbox-plugins?dir=mongodb @ https://raw.githubusercontent.com/jetpack-io/devbox-plugins/master/mongodb/plugin.json (Status code 404).
Please make sure a plugin.json file exists in plugin directory.
```
- **now using code in this PR**
```
❯ ../dist/devbox install
Error: failed to get plugin github:jetpack-io/devbox-plugins?dir=mongodb @ https://raw.githubusercontent.com/jetpack-io/devbox-plugins/master/mongodb/plugin.json (Status code 404).
The auth header `token gh_1*********` was send with this request.
Please make sure a plugin.json file exists in plugin directory.
```
## Community Contribution License
All community contributions in this pull request are licensed to the
project
maintainers under the terms of the
[Apache 2 License](https://www.apache.org/licenses/LICENSE-2.0).
By creating this pull request, I represent that I have the right to
license the
contributions to the project maintainers under the Apache 2 License as
stated in
the
[Community Contribution
License](https://github.com/jetify-com/opensource/blob/main/CONTRIBUTING.md#community-contribution-license).1 parent cc94f70 commit 2017ed6
2 files changed
+73
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
104 | 105 | | |
105 | 106 | | |
106 | 107 | | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
107 | 115 | | |
108 | | - | |
| 116 | + | |
109 | 117 | | |
110 | 118 | | |
111 | 119 | | |
112 | 120 | | |
| 121 | + | |
113 | 122 | | |
114 | 123 | | |
115 | 124 | | |
| |||
147 | 156 | | |
148 | 157 | | |
149 | 158 | | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
150 | 164 | | |
151 | 165 | | |
152 | 166 | | |
| |||
155 | 169 | | |
156 | 170 | | |
157 | 171 | | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
134 | 135 | | |
135 | 136 | | |
136 | 137 | | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
0 commit comments