mumblebaj / MMM-NewsAPI

MagicMirror² module - displaying news articles from Newsapi.org API V2
MIT License
7 stars 5 forks source link

No calls to newsapi being made, no errors either #5

Closed sidevesh closed 2 years ago

sidevesh commented 2 years ago

My config:

        {
            module: "MMM-NewsAPI",
            header: "",
            position: "top_right",
            config: {
                debug: true,
                fetchInterval: 1000,
                apiKey: "------------------------",
                query: {
                    country: "in"
                }
            }
        },

I can see selected choice: headlines in console with debug true but nothing after that and no errors in the container logs too (I am running MM in server only mode in docker) Don't see any requests being made in the newsapi's logs.

sidevesh commented 2 years ago

fetchInterval is 1000 in config only for testing for now, since currently I don't see any requests being made at all.

mumblebaj commented 2 years ago

Your config is incomplete. Please see the 2 examples provided at the bottom of the Readme.

sidevesh commented 2 years ago

Even with the example config copied as is, with only the apiKey replaced, I see the same behavior.

sidevesh commented 2 years ago

new config:

        {
            module: "MMM-NewsAPI",
            header: "news",
            position: "top_right",
            config: {
                apiKey: "---------------",
                type: "horizontal",
                choice: "headlines",
                pageSize: 10,
                sortBy: "relevance",
                drawInterval: 1000*30,
                templateFile: "template.html",
                fetchInterval: 1000*60*60,
                query: {
                        country: "us",
                        category: "",
                        q: "covid",
                        qInTitle: "",
                        sources: "",
                        domains: "nytimes.com",
                        excludeDomains: "",
                        language: ""
                }
            }
        },
mumblebaj commented 2 years ago

Did you run npm install in the MMM-NewsAPI folder after you ran the git clone?

mumblebaj commented 2 years ago

I have just used the following config and I am getting news feed.

{
        module: "MMM-NewsAPI",
        header: "NEWS",
        position: "bottom_bar",
        config: {
                apiKey: "------------------------",
                type: "horizontal",
                choice: "headlines",
                pageSize: 5,
                sortBy: "publishedAt",
                drawInterval: 1000*30,
                templateFile: "template.html",
                fetchInterval: 1000*60*5,
                debug: true,
                query: {
                        country: "in",
                        category: "",
                        q: "",
                        qInTitle: "",
                        sources: "",
                        domains: "",
                        excludeDomains: "",
                        language: ""
                        }
                }
},
mumblebaj commented 2 years ago

Also. This module is best suited for bottom_bar.

sidevesh commented 2 years ago

I did run npm install, would have gotten missing module error otherwise, even with the config you just shared, its the same behavior, I don't see anything in container logs from MMM-NewsAPI either, even the socket connection shows no mention of MMM-NewsAPI, to me it looks like sendSocketNotification doesn't send any message.

mumblebaj commented 2 years ago

Can you check in the Developer WIndow under Console if there are any errors? You can do ctrl + shift + i. You say there are no errors in the terminal or the pm2 logs (if you are running pm2)

sidevesh commented 2 years ago

I restarted the server and it started working! Thanks for the help +1