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

Main function error #139

Closed
pyther opened this issue Mar 11, 2024 · 5 comments
Closed

Main function error #139

pyther opened this issue Mar 11, 2024 · 5 comments
Assignees
Labels
enhancement New feature or request question Further information is requested

Comments

@pyther
Copy link

pyther commented Mar 11, 2024

When starting onstar2mqtt I get a main function error. Any suggestion on how to start debugging this? Thanks.

[root@kai ~]# podman logs onstar2mqtt

> [email protected] start
> node src/index.js

info: OnStar Config {"onstarConfig":{"allowCommands":true,"checkRequestStatus":true,"deviceId":"REDACTED","onStarPin":"REDACTED","password":"REDACTED","refreshInterval":1800000,"requestPollingIntervalSeconds":6,"requestPollingTimeoutSeconds":90,"username":"REDACTED","vin":"REDACTED"},"timestamp":"2024-03-11 15:42:08"}
info: MQTT Config {"mqttConfig":{"host":"127.0.0.1","namePrefix":"","password":"REDACTED","port":1883,"prefix":"homeassistant","tls":false,"username":"mqttuser"},"timestamp":"2024-03-11 15:42:08"}
info: Starting OnStar2MQTT Polling {"timestamp":"2024-03-11 15:42:08"}
info: Requesting vehicles {"timestamp":"2024-03-11 15:42:08"}
info: Vehicle request status {"status":"success","timestamp":"2024-03-11 15:42:11"}
info: Connecting to MQTT {"config":{"username":"mqttuser","will":{"payload":"false","retain":true,"topic":"homeassistant/REDACTED/available"}},"timestamp":"2024-03-11 15:42:11","url":"mqtt://127.0.0.1:1883"}
info: Connected to MQTT! {"timestamp":"2024-03-11 15:42:11"}
info: Subscribed to command topic: {"timestamp":"2024-03-11 15:42:11","topic":"homeassistant/REDACTED/command"}
error: Main function error: {"error":{},"timestamp":"2024-03-11 15:42:11"}
@BigThunderSR
Copy link
Owner

BigThunderSR commented Mar 11, 2024

Based on #134, I'm guessing you forgot to define "--env MQTT_ONSTAR_POLLING_STATUS_TOPIC=".

@pyther
Copy link
Author

pyther commented Mar 11, 2024

Thanks, that did the trick.

@BigThunderSR BigThunderSR added the question Further information is requested label Mar 11, 2024
@pyther
Copy link
Author

pyther commented Mar 11, 2024

For some context, I switched from michaelwoods/onstar2mqtt to your version, due to michaelwoods#347 and just assumed it would be a drop in replacement. You've probably thought of this, but it might be useful to add some checks at startup to ensure necessary environment variables are set.

Anyways, really appreciate the effort in keeping this project active.

@BigThunderSR BigThunderSR added the enhancement New feature or request label Mar 12, 2024
@BigThunderSR
Copy link
Owner

Done as requested in #140 and released in version 1.10.0. Please verify. Thanks.

@pyther
Copy link
Author

pyther commented Mar 13, 2024

Thanks, I pulled down the latest image and it seems to work as expected.

Mar 12 21:37:03 kai onstar2mqtt[25750]: /app/src/index.js:64
Mar 12 21:37:03 kai onstar2mqtt[25750]:         throw new Error(`"${mqttRequiredProperties[prop]}" is not defined`);
Mar 12 21:37:03 kai onstar2mqtt[25750]:         ^
Mar 12 21:37:03 kai onstar2mqtt[25750]:
Mar 12 21:37:03 kai onstar2mqtt[25750]: Error: "MQTT_ONSTAR_POLLING_STATUS_TOPIC" is not defined
Mar 12 21:37:03 kai onstar2mqtt[25750]:     at Object.<anonymous> (/app/src/index.js:64:15)
Mar 12 21:37:03 kai onstar2mqtt[25750]:     at Module._compile (node:internal/modules/cjs/loader:1356:14)
Mar 12 21:37:03 kai onstar2mqtt[25750]:     at Module._extensions..js (node:internal/modules/cjs/loader:1414:10)
Mar 12 21:37:03 kai onstar2mqtt[25750]:     at Module.load (node:internal/modules/cjs/loader:1197:32)
Mar 12 21:37:03 kai onstar2mqtt[25750]:     at Module._load (node:internal/modules/cjs/loader:1013:12)
Mar 12 21:37:03 kai onstar2mqtt[25750]:     at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:128:12)
Mar 12 21:37:03 kai onstar2mqtt[25750]:     at node:internal/main/run_main_module:28:49
Mar 12 21:37:03 kai onstar2mqtt[25750]:
Mar 12 21:37:03 kai onstar2mqtt[25750]: Node.js v18.19.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants