Improve error message for bad enrollment server URLs
- Dominant language
- Go
- Stars
- 1
- Forks
- 0
- Avg merge
- 3d 1h
- Merged PRs (30d)
- 7
Description
While testing the MSI installer, I've forgotten to add the proxy path my test cluster is using:
```powershell
PS C:\Program Files\Graylog\Collector> $env:GLC_SERVER__AUTH__ENROLLMENT_ENDPOINT = "https://hostname"
PS C:\Program Files\Graylog\Collector> $env:GLC_SERVER__AUTH__ENROLLMENT_TOKEN = ""
PS C:\Program Files\Graylog\Collector> & "C:\Program Files\Graylog\Collector\graylog-collector-windows-amd64.exe" supervisor
{"level":"info","ts":1776769833.1377687,"logger":"supervisor","caller":"supervisor/supervisor.go:304","msg":"Starting supervisor","instance_uid":"fcaa1475-c0f6-441e-9a6f-dc6a1fe90d00","endpoint":"https://hostname/v1/opamp"}
{"level":"info","ts":1776769833.1396508,"logger":"supervisor","caller":"supervisor/supervisor.go:780","msg":"Preparing enrollment"}
{"level":"info","ts":1776769833.1401725,"logger":"supervisor.auth","caller":"auth/manager.go:139","msg":"Preparing enrollment","instance_uid":"fcaa1475-c0f6-441e-9a6f-dc6a1fe90d00","endpoint":"https://hostname"}
Error: failed to start supervisor: authentication initialization failed: enrollment preparation failed: failed to fetch JWKS: failed to decode JWKS: invalid character '<' looking for beginning of value
PS C:\Program Files\Graylog\Collector> $env:GLC_SERVER__AUTH__ENROLLMENT_ENDPOINT = "https://hostname/graylog"
```
The error message is likely not helpful for a user, we should include a better description of what might be the issue here.
Contributor guide
Research direction
Start at auth/manager.go:139 and reproduce the enrollment attempt with the endpoint shown in the issue, first without and then with the /graylog proxy path. Trace the JWKS decoding failure and improve the resulting error description so it points users toward an incorrect enrollment server URL or missing proxy path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- authentication
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100