ralberth / MMM-MysqlQuery

MagicMirror plug-in module that displays a table of MySQL SELECT results
MIT License
8 stars 3 forks source link

Cannot read property 'firstChild' of undefined #9

Open Skoo84 opened 5 years ago

Skoo84 commented 5 years ago

deverror.txt I reinstalled my Magic Mirror, and I'm getting the following error with Your module. I simplified the query as much as possible to run it for sure, also no other module is present, but 'alert'.

    at Class.replaceTableRows (MMM-MysqlQuery.js:140)
    at Class.socketNotificationReceived (MMM-MysqlQuery.js:130)
    ...

My config file:

modules: [
        {
            module: "alert",
        },
       {
            module: "MMM-MysqlQuery",
            config: {
                connection: {
                    host: "xxxxxx.ctjatm9stcxs.eu-central-1.rds.amazonaws.com",
                    port: 3306,
                    user: "xxxxxxxxxx",
                    password: "xxxxxxxxxxx",
                    database: "nodemcuweather"
                },
                query: "SELECT id, temp FROM production;",
                    intervalSeconds: 15 * 60,
                emptyMessage: "No spices",
                columns: [
                   { name: "id"      },
                        { name: "temp"    }

                ]
            }
        }
]

I attached my dev log, which gets the results correctly. log.txt config.txt deverror.txt

Skoo84 commented 5 years ago

Apologies, I forgot to add the 'position:' to the code. It works. Thank You for Your module.

ralberth commented 5 years ago

Hi! Thanks for responding and closing it when you got it working, but I'm still miffed at my code for not making it simpler for you to detect this. The main .js file has a bunch of checking up front that all fails when the config.js input doesn't match what it was supposed to see. "position" should probably be part of these checks.

Also, thanks for using AWS! I work for AWS and love to see people using our stuff. How's the experience with RDS databases and AWS in general?

Reopening this so I can track fixing this bad user experience. No need to keep following this if you're happy. I'll close it when I post the bug fix. Cheers!

Skoo84 commented 5 years ago

Hi! I used in the config,js Your sample code from the readme, it does not contain the 'position' also I had to change the ' surrounding the title with quotes to make it work.

Regarding of AWS. I'm close to graduating at a postgraduate program which converts non IT folks to IT one in a couple of years. The last task is to make a research. Mine is about a magic mirror which gathers the data from arduino sensors who send the temperatures via php to a mysql database. The database is Amazon RDS while the php part is running on Elastic Beanstalk on the free tier. While the mirror also having a webcam and a speaker which is using Alexa SDK and I created a skill which reads the php api generated JSONs and deliver the averages and realtime temperature. I also have an another sensor which is recording the employee attendance, and the owner of the mirror can ask Alexa where is who.

Currently I made a view, which should be appear on Your module which displays all the temperatures and daily, weekly, monthly and yearly averages.

I run into another problem. Is there a time limit for queries to run?

[DEBUG][MMM-MysqlQuery] Received { "identifier": "module_0_MMM-MysqlQuery", "connection": { "host": "xxxxxx.ctjatm9stcxs.eu-central-1.rds.amazonaws.com", "port": 3306, "user": "xxxxxx", "password": "xxxxxxxxx", "database": "nodemcuweather" }, "query": "SELECT * from stats" } [DEBUG][MMM-MysqlQuery] Destroying unneeded SQL connection This one is returning an empty table.