[Bug]: Audiobookshelf widget in Homepage is not working #2560

Closed
opened 2026-04-25 00:08:24 +02:00 by adam · 9 comments
Owner

Originally created by @joalmeid on GitHub (Feb 9, 2025).

What happened?

The Homepage tool (https://gethomepage.dev), supports multiple widgets for multiple tools. One is Audiobookshelf which is documented here.
By following documentation and setting up the correct services YAML for the Audiobookshelf widget an error is obtained from the Audiobooksheld API.

What did you expect to happen?

The widget being well rendered in the homepage web page, showing information about the libraries.

Steps to reproduce the issue

  1. Run Homepage app (easier/fastest to use the docker container)
  2. Configure the services.YAML with the Audiobookshelf using the documentation in here
  3. Access the homepage with a browser

Audiobookshelf version

v2.19.0

How are you running audiobookshelf?

Docker

What OS is your Audiobookshelf server hosted from?

Linux

If the issue is being seen in the UI, what browsers are you seeing the problem on?

None

Logs

Captured the logs from AudiobookShelf:

[2025-02-09T16:26:31.229Z] error: <httpProxy> Error calling http://audiobookshelf:XXXX/api/libraries...
[2025-02-09T16:26:31.234Z] error: <httpProxy> [
  500,
  AggregateError
      at internalConnectMultiple (node:net:1114:18)
      at afterConnectMultiple (node:net:1601:5) {
    code: 'ECONNREFUSED',
    [errors]: [ [Error] ]
  }
]
[2025-02-09T16:26:31.235Z] error: <audiobookshelfProxyHandler> Error: Error getting data from Audiobookshelf: 500. Data: [object Object]
    at retrieveFromAPI (/app/.next/server/pages/api/services/proxy.js:1442:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async audiobookshelfProxyHandler (/app/.next/server/pages/api/services/proxy.js:1485:25)
    at async Object.apiResolver (/app/node_modules/.pnpm/next@12.3.4_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/server/api-utils/node.js:366:9)
    at async NextNodeServer.runApi (/app/node_modules/.pnpm/next@12.3.4_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/server/next-server.js:481:9)
    at async Object.fn (/app/node_modules/.pnpm/next@12.3.4_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/server/next-server.js:741:37)
    at async Router.execute (/app/node_modules/.pnpm/next@12.3.4_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/server/router.js:252:36)
    at async NextNodeServer.run (/app/node_modules/.pnpm/next@12.3.4_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/server/base-server.js:365:29)
    at async NextNodeServer.handleRequest (/app/node_modules/.pnpm/next@12.3.4_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/server/base-server.js:303:20)
    at async Server.<anonymous> (/app/server.js:19:5)

Additional Notes

No response

Originally created by @joalmeid on GitHub (Feb 9, 2025). ### What happened? The Homepage tool (https://gethomepage.dev), supports multiple widgets for multiple tools. One is Audiobookshelf which is documented [here](https://gethomepage.dev/widgets/services/audiobookshelf/). By following documentation and setting up the correct services YAML for the Audiobookshelf widget an error is obtained from the Audiobooksheld API. ### What did you expect to happen? The widget being well rendered in the homepage web page, showing information about the libraries. ### Steps to reproduce the issue 1. Run Homepage app (easier/fastest to use the docker container) 2. Configure the services.YAML with the Audiobookshelf using the documentation in [here](https://gethomepage.dev/widgets/services/audiobookshelf/) 3. Access the homepage with a browser ### Audiobookshelf version v2.19.0 ### How are you running audiobookshelf? Docker ### What OS is your Audiobookshelf server hosted from? Linux ### If the issue is being seen in the UI, what browsers are you seeing the problem on? None ### Logs ```shell Captured the logs from AudiobookShelf: [2025-02-09T16:26:31.229Z] error: <httpProxy> Error calling http://audiobookshelf:XXXX/api/libraries... [2025-02-09T16:26:31.234Z] error: <httpProxy> [ 500, AggregateError at internalConnectMultiple (node:net:1114:18) at afterConnectMultiple (node:net:1601:5) { code: 'ECONNREFUSED', [errors]: [ [Error] ] } ] [2025-02-09T16:26:31.235Z] error: <audiobookshelfProxyHandler> Error: Error getting data from Audiobookshelf: 500. Data: [object Object] at retrieveFromAPI (/app/.next/server/pages/api/services/proxy.js:1442:11) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async audiobookshelfProxyHandler (/app/.next/server/pages/api/services/proxy.js:1485:25) at async Object.apiResolver (/app/node_modules/.pnpm/next@12.3.4_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/server/api-utils/node.js:366:9) at async NextNodeServer.runApi (/app/node_modules/.pnpm/next@12.3.4_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/server/next-server.js:481:9) at async Object.fn (/app/node_modules/.pnpm/next@12.3.4_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/server/next-server.js:741:37) at async Router.execute (/app/node_modules/.pnpm/next@12.3.4_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/server/router.js:252:36) at async NextNodeServer.run (/app/node_modules/.pnpm/next@12.3.4_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/server/base-server.js:365:29) at async NextNodeServer.handleRequest (/app/node_modules/.pnpm/next@12.3.4_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/server/base-server.js:303:20) at async Server.<anonymous> (/app/server.js:19:5) ``` ### Additional Notes _No response_
adam added the bug label 2026-04-25 00:08:24 +02:00
adam closed this issue 2026-04-25 00:08:24 +02:00
Author
Owner

@Vito0912 commented on GitHub (Feb 9, 2025):

This appears to be more like an error with the tool you're using.

What API endpoint is it trying to contact, and does it work if you connect to it via a browser directly?

@Vito0912 commented on GitHub (Feb 9, 2025): This appears to be more like an error with the tool you're using. What API endpoint is it trying to contact, and does it work if you connect to it via a browser directly?
Author
Owner

@joalmeid commented on GitHub (Feb 9, 2025):

I can ping the Audiobooksheld container (API) from the homepage container:

docker exec homepage ping audiobookshelf   
PING audiobookshelf (172.19.0.14): 56 data bytes
64 bytes from 172.19.0.14: seq=0 ttl=64 time=0.037 ms
64 bytes from 172.19.0.14: seq=1 ttl=64 time=0.270 ms
64 bytes from 172.19.0.14: seq=2 ttl=64 time=0.202 ms
64 bytes from 172.19.0.14: seq=3 ttl=64 time=0.099 ms

Then I tried to hit the Audiobookshelf API directly, from homepage container:

docker exec -it homepage sh
apk add curl
curl -L -k -u 'xxx:xxx' '[http://audiobookshelf:80/api/libraries?token=xxx](http://audiobookshelf/api/libraries?token=xxx)'
Unauthorized

NOTE: xxx values validated

@joalmeid commented on GitHub (Feb 9, 2025): I can ping the Audiobooksheld container (API) from the homepage container: ``` docker exec homepage ping audiobookshelf PING audiobookshelf (172.19.0.14): 56 data bytes 64 bytes from 172.19.0.14: seq=0 ttl=64 time=0.037 ms 64 bytes from 172.19.0.14: seq=1 ttl=64 time=0.270 ms 64 bytes from 172.19.0.14: seq=2 ttl=64 time=0.202 ms 64 bytes from 172.19.0.14: seq=3 ttl=64 time=0.099 ms ``` Then I tried to hit the Audiobookshelf API directly, from homepage container: ``` docker exec -it homepage sh apk add curl curl -L -k -u 'xxx:xxx' '[http://audiobookshelf:80/api/libraries?token=xxx](http://audiobookshelf/api/libraries?token=xxx)' Unauthorized ``` NOTE: xxx values validated
Author
Owner

@Vito0912 commented on GitHub (Feb 9, 2025):

It is not about pinging. Your second code block is more important.

I am not sure why you provided a token and a user (and whether the user works in abs).

Make sure to use the correct token. Also, try fetching the URL in your browser or with a simple wget command that includes the token parameter nothing more.

@Vito0912 commented on GitHub (Feb 9, 2025): It is not about pinging. Your second code block is more important. I am not sure why you provided a token and a user (and whether the user works in abs). Make sure to use the correct token. Also, try fetching the URL in your browser or with a simple wget command that includes the token parameter nothing more.
Author
Owner

@joalmeid commented on GitHub (Feb 9, 2025):

Yes, tried all, actually:

curl -L -k 'http://audiobookshelf:80/api/libraries?token=xxx'
Unauthorized

curl -L -k -u 'xxx:xxx' 'http://audiobookshelf:80/api/libraries?token=xxx'
Unauthorized

If I hit the url http://audiobookshelf:80/api/libraries?token=xxx from my browser, I get a JSON response:
{"libraries":[{"id":"803baf28-9b0c-4eb5-a9fd-7d5e378400b2","name":"Books","folders" (....)

@joalmeid commented on GitHub (Feb 9, 2025): Yes, tried all, actually: curl -L -k '[http://audiobookshelf:80/api/libraries?token=xxx](http://audiobookshelf/api/libraries?token=xxx)' Unauthorized curl -L -k -u 'xxx:xxx' '[http://audiobookshelf:80/api/libraries?token=xxx](http://audiobookshelf/api/libraries?token=xxx)' Unauthorized If I hit the url [http://audiobookshelf:80/api/libraries?token=xxx](http://audiobookshelf/api/libraries?token=xxx) from my browser, I get a JSON response: {"libraries":[{"id":"803baf28-9b0c-4eb5-a9fd-7d5e378400b2","name":"Books","folders" (....)
Author
Owner

@Vito0912 commented on GitHub (Feb 9, 2025):

Does it work with other things than curl. I am not sure if this is a issue with abs or an misconfiguration as ABS has no way to tell from where you make an connection so it should not block it from that or that place and allow it from a browser

@Vito0912 commented on GitHub (Feb 9, 2025): Does it work with other things than curl. I am not sure if this is a issue with abs or an misconfiguration as ABS has no way to tell from where you make an connection so it should not block it from that or that place and allow it from a browser
Author
Owner

@joalmeid commented on GitHub (Feb 10, 2025):

tried with wget as well:

wget -O - http://audiobookshelf:80/api/libraries?token=xxx

Connecting to audiobookshelf:80 (172.19.0.12:80)
wget: server returned error: HTTP/1.1 401 Unauthorized
@joalmeid commented on GitHub (Feb 10, 2025): tried with wget as well: wget -O - http://audiobookshelf:80/api/libraries?token=xxx ``` Connecting to audiobookshelf:80 (172.19.0.12:80) wget: server returned error: HTTP/1.1 401 Unauthorized ```
Author
Owner

@joalmeid commented on GitHub (Feb 10, 2025):

And did one additional step:

  1. I tested the same URL with the same token using the browser. Got correct JSON response.
  2. Accessed ABS on the browser and logged out my user (from which the token is associated with)
  3. Retried step 1 and got Unauthorized

Once I have my user's API token, can't I just provide it on any request (either by querystring or header as per documentation) to the ABS API? Why is login making any difference?

@joalmeid commented on GitHub (Feb 10, 2025): And did one additional step: 1. I tested the same URL with the same token using the browser. Got **correct** JSON response. 2. Accessed ABS on the browser and **logged out** my user (from which the token is associated with) 3. Retried step 1 and got **Unauthorized** Once I have my user's API token, can't I just provide it on any request (either by querystring or header as per documentation) to the ABS API? Why is login making any difference?
Author
Owner

@joalmeid commented on GitHub (Feb 10, 2025):

Issue found.

API token being used was from a user with an account type of root in ABS. That presumably requires the user to be logged in to access the API.

Created another user with account type as user and the homepage widget worked perfectly fine.

Thanks for the support @Vito0912

@joalmeid commented on GitHub (Feb 10, 2025): Issue found. API token being used was from a user with an account type of **root** in ABS. That presumably requires the user to be logged in to access the API. Created another user with account type as **user** and the homepage widget worked perfectly fine. Thanks for the support @Vito0912
Author
Owner

@averageyogi commented on GitHub (Feb 12, 2025):

Just a further note, homepage does indicate using an Admin user's API token: https://gethomepage.dev/widgets/services/audiobookshelf/, but doesn't specifically list any problem on the documentation page about using Root, User, or Guest tokens.

@averageyogi commented on GitHub (Feb 12, 2025): Just a further note, homepage does indicate using an Admin user's API token: https://gethomepage.dev/widgets/services/audiobookshelf/, but doesn't specifically list any problem on the documentation page about using Root, User, or Guest tokens.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#2560