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

[Bug] Jellyfin widget: TypeError #493

Closed
ditek opened this issue Nov 6, 2022 · 23 comments
Closed

[Bug] Jellyfin widget: TypeError #493

ditek opened this issue Nov 6, 2022 · 23 comments
Labels
bug Something isn't working

Comments

@ditek
Copy link

ditek commented Nov 6, 2022

Description

The Jellyfin widget seems to crash with a TypeError displaying the bellow call stack:
image

I don't think it's an issue accessing the API, as that usually just shows "API Error".

Steps to reproduce

  1. Add the jellyfin widget in services.yaml.
- Multimedia:
    - Jellyfin:
        href: http://192.168.0.142:8096
        icon: jellyfin
        container: jellyfin
        widget:
            type: jellyfin
            url: http://192.168.0.142:8096
            key: xxx
  1. Reload Homepage.

homepage version

v0.4.18 (4ea2798, Oct 15, 2022)

Installation method

Docker

Configuration

No response

Other

No response

@ditek ditek added the bug Something isn't working label Nov 6, 2022
@shamoon
Copy link
Collaborator

shamoon commented Nov 6, 2022

Can you confirm you looked at https://gethomepage.dev/en/more/troubleshooting/ ? If so, providing the output of e.g. the curl might be helpful.

@ditek
Copy link
Author

ditek commented Nov 6, 2022

Not sure which endpoints are triggered by the widget, but curling the API in general works:

curl -kL http://192.168.0.142:8096/Startup/FirstUser?api_key=xxx
{"Name":"myuser"}

The troubleshooting guide you linked to mentions checking src/widgets/{widget}/widget.js for testing the API call, but there is no jellyfin directory in src/widgets. However, widgets.js has

jellyfin: emby,

which I think means to use the emby API. Could this be the problem? emby/widget.js has the following:

  api: "{url}/emby/{endpoint}?api_key={key}",

which is not the URL format for jellyfin.
https://api.jellyfin.org

@ditek
Copy link
Author

ditek commented Nov 6, 2022

I tried the curl command from within the docker container (after installing it with apk) and it worked:

$ docker exec Homepage curl -kL http://192.168.0.142:8096/Startup/FirstUser?api_key=xxx
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    15    0    15    0     0    361      0 --:--:-- --:--:-- --:--:--   384
{"Name":"myuser"}

I then cloned the project and used the same services.yaml and ran it with npm start, this time the widget actually worked. So it's clearly an issue with my setup.
But if curl works from within the container and the exact same configuration works when run from source, any ideas what else could be the issue?

@ditek
Copy link
Author

ditek commented Nov 6, 2022

I'm as surprised as you are, but it certainly works when run from source:
image

@shamoon
Copy link
Collaborator

shamoon commented Nov 6, 2022

Ha, ok =) well the two projects must be pretty closely related (I dont use either)

so what happens when you curl the above http://192.168.0.142:8096/emby/Sessions?api_key=xxx from within the container?

@ditek
Copy link
Author

ditek commented Nov 6, 2022

Adding emby to the URL still work!

$ docker exec Homepage curl -kL http://192.168.0.142:8096/emby/Startup/FirstUser?api_key=xxx
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    15    0    15    0     0    417      0 --:--:-- --:--:-- --:--:--   468
{"Name":"myuser"}

@ditek
Copy link
Author

ditek commented Nov 6, 2022

But maybe the widget code should be changed anyway for clarity and in case they change their API in the future?

@shamoon
Copy link
Collaborator

shamoon commented Nov 6, 2022

Yea i can see how its confusing but it also seems unlikely jellyfin will remove that API endpoint for legacy reasons, clearly they are somehow related in the past. I think its ok to cross that bridge if we ever do get there.

@ditek
Copy link
Author

ditek commented Nov 6, 2022

Good point. I think I can close this now.
Any ideas on what I can also check to debug my issue?

@shamoon
Copy link
Collaborator

shamoon commented Nov 6, 2022

Well, you still havent told us the output of the actual endpoint used by the widget e.g. http://192.168.0.142:8096/emby/Sessions?api_key=xxx =)

@ditek
Copy link
Author

ditek commented Nov 6, 2022

Ah, sorry. I thought you meant curling any endpoint to check connectivity and I chose the other one since it had shorter output. Here is the session endpoint.
Session.txt

@shamoon
Copy link
Collaborator

shamoon commented Nov 6, 2022

Hmm, looks normal-ish. I will test a bit. Hmm, re-creating containers helps sometimes?

@ditek
Copy link
Author

ditek commented Nov 6, 2022

I can try that.

@ditek
Copy link
Author

ditek commented Nov 6, 2022

Recreating the container didn't change much.
Anyway, I don't want to take more of your time. I can live without this particular widget.
If you think of anything else I can try, feel free to let me know.
Have a nice day :-)

@ditek ditek closed this as completed Nov 6, 2022
@shamoon
Copy link
Collaborator

shamoon commented Nov 6, 2022

Yea sorry Im not able to reproduce that even with your data 🤔. Please do let us know if you sort it out.

Screen Shot 2022-11-05 at 8 43 59 PM

@shamoon shamoon reopened this Nov 6, 2022
@ditek
Copy link
Author

ditek commented Nov 6, 2022

Just noticed that the request sent from my Pi's container does not have cookies:

image

While the one sent from my Mac (also using the latest docker container) does:

image

Both use the endpoint /api/services/proxy?type=jellyfin&group=Multimedia&service=Jellyfin&endpoint=Sessions.

@shamoon
Copy link
Collaborator

shamoon commented Nov 6, 2022

Yea so this is actually an API error, somehow. If you look in your browser network tab I think you'll see the proxy calls to it returning {"error":"Unexpected error"} I think. The widget should show an API error, thats easy enough to fix (I already did) but Im not certain why the proxy is failing (not the cookie thing)

@ditek
Copy link
Author

ditek commented Nov 6, 2022

If you look in your browser network tab I think you'll see the proxy calls to it returning {"error":"Unexpected error"}

Yes, that's exactly what it's returning.

@shamoon
Copy link
Collaborator

shamoon commented Nov 6, 2022

What do the docker logs show? docker logs homepage
Can you try using ghcr.io/benphelps/homepage:main ?

@shamoon
Copy link
Collaborator

shamoon commented Nov 6, 2022

I at least fixed the api error display in b25ba09 but not sure what the real issue is with your setup

@shamoon shamoon closed this as completed Nov 6, 2022
@ditek
Copy link
Author

ditek commented Nov 6, 2022

So decided to start a fresh, deleting and rebooting the system. I created a container from main and the widget worked. I reverted back to latest and it worked!

@shamoon
Copy link
Collaborator

shamoon commented Nov 6, 2022

Well great. Also, shrug

Copy link
Contributor

github-actions bot commented Feb 6, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new discussion for related concerns.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants