You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bug description
When authing a new user via oidc (with email stripping DISABLED, I didn't test with it enabled) the following error occures and the namespace isn't created:
[GIN] 2022/02/27 - 21:54:06 | 302 | 118.701µs | redacated | GET "/oidc/register/mkey:redacated"
2022-02-27T21:54:06Z ERR ../home/runner/work/headscale/headscale/oidc.go:319 > could not find or create namespace error="Namespace not found" namespace=redacatednamespace
[GIN] 2022/02/27 - 21:54:06 | 500 | 161.557551ms | redacated | GET "/oidc/callback?code=0redacated"
2022-02-27T21:54:09Z WRN Ignoring request, cannot find machine with key mkey:redacated handler=PollNetMap
[GIN] 2022/02/27 - 21:54:09 | 401 | 1.083608ms | 118.92.104.24 | POST "/machine/redacated/map"
To Reproduce
With email stripping disabled, configure an oidc (tested with azure ad) and have a user attempt to login with [email protected].
Context info
0.15-beta1
tailscale client 1.22.0
Client OS Windows 11
[GIN] 2022/02/27 - 21:54:06 | 302 | 118.701µs | redacated | GET "/oidc/register/mkey:redacated"
2022-02-27T21:54:06Z ERR ../home/runner/work/headscale/headscale/oidc.go:319 > could not find or create namespace error="Namespace not found" namespace=redacatednamespace
[GIN] 2022/02/27 - 21:54:06 | 500 | 161.557551ms | redacated | GET "/oidc/callback?code=0redacated"
2022-02-27T21:54:09Z WRN Ignoring request, cannot find machine with key mkey:redacated handler=PollNetMap
[GIN] 2022/02/27 - 21:54:09 | 401 | 1.083608ms | 118.92.104.24 | POST "/machine/redacated/map"
I fixed and tested this with the following fix:
Line 302 of oidc.go changed from if errors.Is(err, gorm.ErrRecordNotFound) { to if errors.Is(err, errNamespaceNotFound) {
I also had to comment out line 20 of oidc.go "gorm.io/gorm" because the go compiler complained that gorm wasn't being used :)
It looks like getnamespace returns "errNamespaceNotFound" ("Namespace not found") but the if statement on line 302 is just looking for gorm.ErrRecordNotFound and so it falls through to line 317 } else if err != nil { and errors out.
The text was updated successfully, but these errors were encountered:
Bug description
When authing a new user via oidc (with email stripping DISABLED, I didn't test with it enabled) the following error occures and the namespace isn't created:
To Reproduce
With email stripping disabled, configure an oidc (tested with azure ad) and have a user attempt to login with [email protected].
Context info
I fixed and tested this with the following fix:
Line 302 of oidc.go changed from
if errors.Is(err, gorm.ErrRecordNotFound) {
toif errors.Is(err, errNamespaceNotFound) {
I also had to comment out line 20 of oidc.go
"gorm.io/gorm"
because the go compiler complained that gorm wasn't being used :)It looks like getnamespace returns "errNamespaceNotFound" ("Namespace not found") but the if statement on line 302 is just looking for gorm.ErrRecordNotFound and so it falls through to line 317
} else if err != nil {
and errors out.The text was updated successfully, but these errors were encountered: