question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

docker env "PSN_ACCOUNTS" mandatory

See original GitHub issue

Description of the issue

Hello, upgrading from 0.7.1 to 1.0.1 (HA Core) yields an error.

After adding ENV PSN_ACCOUNTS everything works as expected 👍

  ps5-mqtt:
    container_name: ps5-mqtt
    image: ghcr.io/funkeyflo/ps5-mqtt/amd64
    volumes:
      - /volume1/docker/ps5-mqtt:/config
    network_mode: host
    entrypoint: /config/run.sh
    environment:
      - MQTT_HOST=${MQTT_HOST}
      - DEVICE_CHECK_INTERVAL=5000
      - DEVICE_DISCOVERY_INTERVAL=60000
      - INCLUDE_PS4_DEVICES=false
      - FRONTEND_PORT=8645
      - CREDENTIAL_STORAGE_PATH=/config/credentials.json
      - 'PSN_ACCOUNTS=[{"username": "PSN", "npsso":"${NPSSO}"}]' # <- mandatory
      - ACCOUNT_CHECK_INTERVAL=5000
      - DEBUG=@ha:ps5:*
    restart: always

Addon version

1.0.1

Platform

Home Assistant 2022.8.6 Frontend-version: 20220802.0 - latest

Logs of the issue (if applicable)

SyntaxError: Unexpected token u in JSON at position 0
    at JSON.parse (<anonymous>)
    at Object.<anonymous> (/app/server/dist/index.js:81:25)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
    at node:internal/main/run_main_module:17:47
Starting PS5-MQTT...
undefined:1
undefined
^

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
FunkeyFlocommented, Aug 21, 2022

Ah, the regular HA add-on .sh script handles the null value normally. But that obviously doesn’t work for docker installs.

I’ll add a check to the server as well when I get back from holiday.

For now a workaround would be to use the following value when not supplying PSN accounts:

...
environment:
      ...
      - PSN_ACCOUNTS=[]
      ...
0reactions
AlexKalopsiacommented, Nov 9, 2022

Hi there, I still get the error config could not be read from 'undefined'

Full log below:

Starting PS5-MQTT...
2022-11-09T10:36:04.865Z @ha:ps5:error config could not be read from 'undefined'
2022-11-09T10:36:05.422Z @ha:ps5:error Error:
      There was a problem retrieving your PSN access code. Is your NPSSO code valid?
      To get a new NPSSO code, visit https://ca.account.sony.com/api/v1/ssocookie.

    at _callee$ (/app/node_modules/psn-api/dist/psn-api.cjs.development.js:948:19)
    at tryCatch (/app/node_modules/psn-api/dist/psn-api.cjs.development.js:144:40)
    at Generator.invoke [as _invoke] (/app/node_modules/psn-api/dist/psn-api.cjs.development.js:375:22)
    at Generator.next (/app/node_modules/psn-api/dist/psn-api.cjs.development.js:200:21)
    at asyncGeneratorStep (/app/node_modules/psn-api/dist/psn-api.cjs.development.js:13:24)
    at _next (/app/node_modules/psn-api/dist/psn-api.cjs.development.js:35:9)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
2022-11-09T10:36:05.455Z @ha:ps5:webserver Server listening on PORT: 8645

my docker-compose.yaml

ps5-mqtt:
    container_name: ps5-mqtt
    image: ghcr.io/funkeyflo/ps5-mqtt/amd64:latest
    entrypoint: /config/run.sh
    volumes:
      - ${DOCKER_PATH}/ps5-mqtt/config:/config
    network_mode: host
    environment:
      - CONFIG_PATH=/config/options.json
      - FRONTEND_PORT=8645
      - CREDENTIAL_STORAGE_PATH=/config/credentials.json
      - DEBUG=@ha:ps5:*

my config/options.json

{
    "mqtt": {
        "host": "MYIP",
        "port": "1883",
        "user": "",
        "pass": ""
    },
    "device_check_interval": 5000,
    "device_discovery_interval": 60000,
    "include_ps4_devices": false,
    "psn_accounts": [{ 
        "username": "MYPSNID", 
        "npsso": "MYNPSSO",
        "preferred_ps5": "PS5ID"
         }],
    "account_check_interval": 5000
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Require environment variables to be given to image when run ...
Is there a way that docker [container] run checks that an environment variable is given to the container before starting it. docker ......
Read more >
Add mandatory environment variables to docker compose file
I propose that we add CMD_DOMAIN to the docker compose file. ... Add mandatory environment variables to docker compose file #189.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found