karlomikus / bar-assistant

Bar assistant is a all-in-one solution for managing your home bar
https://barassistant.app
MIT License
592 stars 22 forks source link

Provided hostUrl value (1st parameter) is not a string, expected string #345

Closed dlmw closed 1 month ago

dlmw commented 1 month ago

Describe the bug When I go to "Menu", click on "Add menu category" and "Add cocktail", the following error appears in the console: "Provided hostUrl value (1st parameter) is not a string, expected string"

However, I have kind of a weird setup, because I use Caddy and had to write the following config file in order to have images correctly displayed:

bar.dlmw.ch {
    @uploads {
        path_regexp uploads ^/uploads/(.*)
    }
    rewrite @uploads /bar/uploads/{re.uploads.1}

    handle_path /search/* {
        reverse_proxy meilisearch:7700
    }
    handle_path /bar/* {
        reverse_proxy barassistant:8080
    }
    handle_path /* {
        reverse_proxy saltrim:8080
    }
}

It's hard to troubleshoot the issue but I wondered if you had the time to help me. :)

To Reproduce See above.

Versions:

Additional context, log outputs... [Add any other context about the problem here.]

karlomikus commented 1 month ago

This looks like an issue with meilisearch host URL.

Make sure your .env file has correct URL. Can you post what is the output of window.srConfig from your salt-rim browser console.

dlmw commented 1 month ago

Here's the ouput of window.srConfig:

{
  "VERSION": "v3.2.1",
  "API_URL": "https://bar.dlmw.ch/bar",
  "MEILISEARCH_URL": "https://bar.dlmw.ch/search",
  "DEFAULT_LOCALE": "en-US",
  "ENV": "",
  "MAILS_ENABLED": false,
  "BILLING_TOKEN": "",
  "BILLING_ENABLED": false,
  "BILLING_ENV": "",
  "ANALYTICS_HOST": "",
  "ALLOW_REGISTRATION": ""
}

And just in case, here's what the relevant environment variables look like:

barassistant:
  image: barassistant/server:4.0.2
  depends_on:
    - meilisearch
    - redis
  environment:
    - APP_URL=https://bar.dlmw.ch
    - LOG_CHANNEL=stderr
    - MEILISEARCH_KEY=[REDACTED]
    - MEILISEARCH_HOST=http://meilisearch:7700

saltrim:
  image: barassistant/salt-rim:3.2.1
  depends_on:
    - barassistant
  environment:
    - API_URL=https://bar.dlmw.ch/bar
    - MEILISEARCH_URL=https://bar.dlmw.ch/search
    - BAR_NAME=dlmw
karlomikus commented 1 month ago

That all seems alright. Can you try signing out and signing back in, or check it in incognito/private browsing mode.

If that does not help, post the output of localStorage.getItem('_salt_rim') in your browser console. This is the object that contains the final host_url that gets used by meilisearch client.

dlmw commented 1 month ago

I got logged out so I tried again and now it works. The search button also had the exact same issue but it's working perfectly now.

I wonder what would cause that kind of issue, but I'm glad it's working. Hopefully that can help someone in the future with a similar issue!

karlomikus commented 1 month ago

Some internal settings are saved when you select a bar, if they got broken somehow in the meantime, logout can help.

Glad you got it working.