Skip to content

[Bug] Invite workflow ends on a 500 error when Discord and Jellyseerr are enabled #375

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

Open
Mavyre opened this issue Nov 19, 2024 · 2 comments

Comments

@Mavyre
Copy link
Contributor

Mavyre commented Nov 19, 2024

Read the FAQ first!

Describe the bug

Users encounter error 500 on email validation during account creation via an invation link.

To Reproduce

  • Enable Discord and Jellyseerr
  • Enable Email verification
  • Use an invite link to create an account
  • After verifying the email, user get a 500 error
  • User is still created, and the policy is applied, but doesn't receive welcome email, and the email contact isn't added on Jellyseerr

Logs


2024/11/19 15:48:50	stdout	[ERROR] 15:48:50 users.go:125: �[31mFailed to apply configuration template for Jellyfin user "f7e56080058a483292f6b65606d54db6": 400 Unauthorized, check credentials.�[0m
2024/11/19 15:48:51	stdout	
2024/11/19 15:48:51	stdout	
2024/11/19 15:48:51	stdout	�[31m2024/11/19 15:48:51 [Recovery] 2024/11/19 - 15:48:51 panic recovered:
2024/11/19 15:48:51	stdout	GET /invite/bcjydnu6z6QDpdWVdWXN5b?key=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MzIwMjk0OTcsImludml0ZSI6ImJjanlkbnU2ejZRRHBkV1ZkV1hONWIiLCJ0eXBlIjoiY29uZmlybWF0aW9uIiwidmFsaWQiOnRydWV9.14N0NMZ7wLQn2OGvTxQGTGKtkkyuZgnsvvuBv2yrwX0 HTTP/1.1
2024/11/19 15:48:51	stdout	Host: account.bastflix.vydees.net
2024/11/19 15:48:51	stdout	Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8
2024/11/19 15:48:51	stdout	Accept-Encoding: gzip, deflate, br, zstd
2024/11/19 15:48:51	stdout	Accept-Language: en-GB,en;q=0.9
2024/11/19 15:48:51	stdout	Connection: close
2024/11/19 15:48:51	stdout	Dnt: 1
2024/11/19 15:48:51	stdout	Sec-Ch-Ua: "Chromium";v="130", "Brave";v="130", "Not?A_Brand";v="99"
2024/11/19 15:48:51	stdout	Sec-Ch-Ua-Mobile: ?0
2024/11/19 15:48:51	stdout	Sec-Ch-Ua-Platform: "macOS"
2024/11/19 15:48:51	stdout	Sec-Fetch-Dest: document
2024/11/19 15:48:51	stdout	Sec-Fetch-Mode: navigate
2024/11/19 15:48:51	stdout	Sec-Fetch-Site: none
2024/11/19 15:48:51	stdout	Sec-Fetch-User: ?1
2024/11/19 15:48:51	stdout	Sec-Gpc: 1
2024/11/19 15:48:51	stdout	Upgrade-Insecure-Requests: 1
2024/11/19 15:48:51	stdout	User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36
2024/11/19 15:48:51	stdout	X-Forwarded-By: 192.168.82.2
2024/11/19 15:48:51	stdout	X-Forwarded-For: 192.168.82.135
2024/11/19 15:48:51	stdout	X-Forwarded-Port: 443
2024/11/19 15:48:51	stdout	X-Forwarded-Proto: https
2024/11/19 15:48:51	stdout	X-Real-Ip: 192.168.82.135
2024/11/19 15:48:51	stdout	
2024/11/19 15:48:51	stdout	
2024/11/19 15:48:51	stdout	interface conversion: main.ContactMethodUser is nil, not *main.DiscordUser
2024/11/19 15:48:51	stdout	/usr/local/go/src/runtime/iface.go:262 (0x413e30)
2024/11/19 15:48:51	stdout	panicdottypeE: for _, md := range activeModules() {
2024/11/19 15:48:51	stdout	/usr/local/go/src/runtime/iface.go:272 (0x413de9)
2024/11/19 15:48:51	stdout	panicdottypeI: // want = the static type we're trying to convert to.
2024/11/19 15:48:51	stdout	/opt/build/api-users.go:332 (0xf376a8)
2024/11/19 15:48:51	stdout	/opt/build/views.go:688 (0xfae06a)
2024/11/19 15:48:51	stdout	/opt/build/views.go:738 (0xfaf667)
2024/11/19 15:48:51	stdout	/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:185 (0x97e6f9)
2024/11/19 15:48:51	stdout	/go/pkg/mod/github.com/gin-gonic/[email protected]/recovery.go:102 (0x97e6e7)
2024/11/19 15:48:51	stdout	/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:185 (0x97d824)
2024/11/19 15:48:51	stdout	/go/pkg/mod/github.com/gin-gonic/[email protected]/logger.go:249 (0x97d80b)
2024/11/19 15:48:51	stdout	/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:185 (0x97cc11)
2024/11/19 15:48:51	stdout	/go/pkg/mod/github.com/gin-gonic/[email protected]/gin.go:633 (0x97c680)
2024/11/19 15:48:51	stdout	/go/pkg/mod/github.com/gin-gonic/[email protected]/gin.go:589 (0x97c1b1)
2024/11/19 15:48:51	stdout	/usr/local/go/src/net/http/server.go:3142 (0x7127ed)
2024/11/19 15:48:51	stdout	serverHandler.ServeHTTP: // StateClosed.
2024/11/19 15:48:51	stdout	/usr/local/go/src/net/http/server.go:2044 (0x70dac7)
2024/11/19 15:48:51	stdout	(*conn).serve: // We purposefully aren't echoing back the transfer-encoding's value,
2024/11/19 15:48:51	stdout	/usr/local/go/src/runtime/asm_amd64.s:1695 (0x47dc40)
2024/11/19 15:48:51	stdout	goexit: RET
2024/11/19 15:48:51	stdout	�[0m
2024/11/19 15:48:51	stdout	�[2m[GIN/DEBUG] 15:48:51: GET(/invite/bcjydnu6z6QDpdWVdWXN5b?key=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MzIwMjk0OTcsImludml0ZSI6ImJjanlkbnU2ejZRRHBkV1ZkV1hONWIiLCJ0eXBlIjoiY29uZmlybWF0aW9uIiwidmFsaWQiOnRydWV9.14N0NMZ7wLQn2OGvTxQGTGKtkkyuZgnsvvuBv2yrwX0) => 500 in 1.582442156s; 

Configuration

Irrelevant

Platform/Version

From Docker Hub hfree/jfa-go:unstable

Version git
Commit 11eb907
Build Time 2024-10-11 17:16:36 +0200 CEST
Built By "???"
Build Tags [e2ee external]

@Mavyre Mavyre changed the title Invite workflow ends on a 500 error when Discord and Jellyseerr are enabled [Bug] Invite workflow ends on a 500 error when Discord and Jellyseerr are enabled Nov 19, 2024
@hrfee
Copy link
Owner

hrfee commented Nov 21, 2024

sorry, I can't replicate this, even on commit 11eb907. Would you be able to test again on the latest unstable?

@Mavyre
Copy link
Contributor Author

Mavyre commented Nov 21, 2024

Updated on latest jfa-go:unstable (0ccc314) and still the same:

[ERROR] 00:32:20 users.go:125: Failed to apply configuration template for Jellyfin user "66194c66203943539d8bd5938261354f": 400 Unauthorized, check credentials.
2024/11/22 00:32:21 [Recovery] 2024/11/22 - 00:32:21 panic recovered:
GET /invite/sdCPYDjL2zBBCwkgMj8ogk?key=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MzIyMzM3MjgsImludml0ZSI6InNkQ1BZRGpMMnpCQkN3a2dNajhvZ2siLCJ0eXBlIjoiY29uZmlybWF0aW9uIiwidmFsaWQiOnRydWV9.8nuRZhFM5CqFkRbGy_osDSJ3hDFGx3vDCVD6J2ZokOM HTTP/1.1
Host: account.bastflix.vydees.net
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8
Accept-Encoding: gzip, deflate, br, zstd
Accept-Language: en-GB,en;q=0.9
Connection: close
Dnt: 1
Sec-Ch-Ua: "Chromium";v="130", "Brave";v="130", "Not?A_Brand";v="99"
Sec-Ch-Ua-Mobile: ?0
Sec-Ch-Ua-Platform: "macOS"
Sec-Fetch-Dest: document
Sec-Fetch-Mode: navigate
Sec-Fetch-Site: none
Sec-Fetch-User: ?1
Sec-Gpc: 1
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36
X-Forwarded-By: 192.168.82.2
X-Forwarded-Port: 443
X-Forwarded-Proto: https
X-Real-Ip: 192.168.82.135

interface conversion: main.ContactMethodUser is nil, not *main.DiscordUser
/usr/local/go/src/runtime/iface.go:262 (0x413e30)
	panicdottypeE: for _, md := range activeModules() {
/usr/local/go/src/runtime/iface.go:272 (0x413de9)
	panicdottypeI: // want = the static type we're trying to convert to.
/opt/build/api-users.go:340 (0xf4d0c8)
/opt/build/views.go:688 (0xfc3a6a)
/opt/build/views.go:738 (0xfc5067)
/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:185 (0x980519)
/go/pkg/mod/github.com/gin-gonic/[email protected]/recovery.go:102 (0x980507)
/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:185 (0x97f644)
/go/pkg/mod/github.com/gin-gonic/[email protected]/logger.go:249 (0x97f62b)
/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:185 (0x97ea31)
/go/pkg/mod/github.com/gin-gonic/[email protected]/gin.go:633 (0x97e4a0)
/go/pkg/mod/github.com/gin-gonic/[email protected]/gin.go:589 (0x97dfd1)
/usr/local/go/src/net/http/server.go:3142 (0x712fcd)
	serverHandler.ServeHTTP: // StateClosed.
/usr/local/go/src/net/http/server.go:2044 (0x70e2a7)
	(*conn).serve: // We purposefully aren't echoing back the transfer-encoding's value,
/usr/local/go/src/runtime/asm_amd64.s:1695 (0x47dc40)
	goexit: RET
[GIN/DEBUG] 00:32:21: GET(/invite/sdCPYDjL2zBBCwkgMj8ogk?key=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MzIyMzM3MjgsImludml0ZSI6InNkQ1BZRGpMMnpCQkN3a2dNajhvZ2siLCJ0eXBlIjoiY29uZmlybWF0aW9uIiwidmFsaWQiOnRydWV9.8nuRZhFM5CqFkRbGy_osDSJ3hDFGx3vDCVD6J2ZokOM) => 500 in 966.991846ms; 

Maybe something wrong in my config? Would you like me to post the discord section of it?

EDIT: After further testing, linking a Discord account doesn't trigger this error. Disabling either Discord or Jellyseerr from the configuration doesn't make the error appear neither.
So it seems like it's a combination of having Discord enabled, Jellyseer enabled, and a user registering without linking a Discord account.

Edit 2: further diagnostic and understanding of the code:
In api-users.go, the code block from line 336 to 347 seem not to check if user has linked or not their Other contact methods before sending it to Jellyseerr or Ombi.
In my case, the line 340 triggers the cast typing error:

discordUser = req.completeContactMethods[0].User.(*DiscordUser)

When the user didn't complete the linking, req.completeContactMethods[0].User is nil, and therefore cannot be casted.
Adding a check to ensure that req.completeContactMethods[0].User is not nil before casting it should do the trick.
I didn't test with Telegram contact method, but it might have the exact same issue...

I would love to help but, however, do not know anything about dev in golang and didn't setup a dev env, yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants