randomBrainstormer / MMM-GoogleCalendar

Google Calendar for MagicMirror²
MIT License
64 stars 42 forks source link

FetchError: reason: connect ETIMEDOUT #58

Closed jwig22 closed 4 months ago

jwig22 commented 4 months ago

The main part of the error is this:

0|MagicMirror  | [24.02.2024 22:38.48.439] [ERROR] MMM-GoogleCalendar Error. Could not fetch calendar:  [calendar_ID] FetchError: request to https://oauth2.googleapis.com/token failed, reason: connect ETIMEDOUT 2607:f8b0:4025:803::200a:443

I've verified that my 'credentials.json' is in the correct module folder. I've ran the 'node authorize.js'. After completing setup I get this error in my Magic Mirror setup: "Error in the MMM-GoogleCalendar module. Check logs for more details."

I haven't been able to get any of my calendars to show up using the standard calendar module or the MMM-CalendarExt3 module either. They never load. Does Google hate sharing my calendar or am I screwing something up in my config file?

Oh by the way, I'm running MagicMirror v2.26.0 on a RPi Zero 2 W with Node v20.x and used sdetweil / MagicMirror_scripts to install it.

Given that it's an RPi Zero 2 W, maybe it's authenticating too slowly. Would I be better off trying to use a different browser besides Chromium to run MM2?

Below is the info in my logs:

0|MagicMirror  | Warning: vkCreateInstance: Found no drivers!
0|MagicMirror  | Warning: vkCreateInstance failed with VK_ERROR_INCOMPATIBLE_DRIVER
0|MagicMirror  |     at CheckVkSuccessImpl (../../third_party/dawn/src/dawn/native/vulkan/VulkanError.cpp:88)
0|MagicMirror  |     at CreateVkInstance (../../third_party/dawn/src/dawn/native/vulkan/BackendVk.cpp:458)
0|MagicMirror  |     at Initialize (../../third_party/dawn/src/dawn/native/vulkan/BackendVk.cpp:344)
0|MagicMirror  |     at Create (../../third_party/dawn/src/dawn/native/vulkan/BackendVk.cpp:266)
0|MagicMirror  |     at operator() (../../third_party/dawn/src/dawn/native/vulkan/BackendVk.cpp:521)
0|MagicMirror  | [24.02.2024 22:38.48.439] [ERROR] MMM-GoogleCalendar Error. Could not fetch calendar:  [calendar_ID] FetchError: request to https://oauth2.googleapis.com/token failed, reason: connect ETIMEDOUT 2607:f8b0:4025:803::200a:443
0|MagicMirror  |     at ClientRequest.<anonymous> (/home/jwigington22/MagicMirror/modules/MMM-GoogleCalendar/node_modules/node-fetch/lib/index.js:1491:11)
0|MagicMirror  |     at ClientRequest.emit (node:events:514:28)
0|MagicMirror  |     at TLSSocket.socketErrorListener (node:_http_client:501:9)
0|MagicMirror  |     at TLSSocket.emit (node:events:514:28)
0|MagicMirror  |     at emitErrorNT (node:internal/streams/destroy:151:8)
0|MagicMirror  |     at emitErrorCloseNT (node:internal/streams/destroy:116:3)
0|MagicMirror  |     at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
0|MagicMirror  |   type: 'system',
0|MagicMirror  |   errno: 'ETIMEDOUT',
0|MagicMirror  |   code: 'ETIMEDOUT',
0|MagicMirror  |   config: {
0|MagicMirror  |     method: 'POST',
0|MagicMirror  |     url: 'https://oauth2.googleapis.com/token',
0|MagicMirror  |     data: 'refresh_token=[REDACTED]=refresh_token',
0|MagicMirror  |     headers: {
0|MagicMirror  |       'Content-Type': 'application/x-www-form-urlencoded',
0|MagicMirror  |       'User-Agent': 'google-api-nodejs-client/8.5.2',
0|MagicMirror  |       'x-goog-api-client': 'gl-node/18.17.1 auth/8.5.2',
0|MagicMirror  |       Accept: 'application/json'
0|MagicMirror  |     },
0|MagicMirror  |     paramsSerializer: [Function: paramsSerializer],
0|MagicMirror  |     body: 'refresh_token=[REDACTED=refresh_token',
0|MagicMirror  |     validateStatus: [Function: validateStatus],
0|MagicMirror  |     responseType: 'json'
0|MagicMirror  |   }
0|MagicMirror  | }

And here is my config.js file:

/* MagicMirror² Config Sample
 *
 * By Michael Teeuw https://michaelteeuw.nl
 * MIT Licensed.
 *
 * For more information on how you can configure this file
 * see https://docs.magicmirror.builders/configuration/introduction.html
 * and https://docs.magicmirror.builders/modules/configuration.html
 *
 * You can use environment variables using a `config.js.template` file instead of `config.js`
 * which will be converted to `config.js` while starting. For more information
 * see https://docs.magicmirror.builders/configuration/introduction.html#enviromnent-variables
 13 */
let config = {
    address: "localhost",   // Address to listen on, can be:
                            // - "localhost", "127.0.0.1", "::1" to listen on loopback interface
                            // - another specific IPv4/6 to listen on a specific interface
                            // - "0.0.0.0", "::" to listen on any interface
                            // Default, when address config is left out or empty, is "localhost"
    port: 8080,
    basePath: "/",  // The URL path where MagicMirror² is hosted. If you are using a Reverse proxy
                                    // you must set the sub path here. basePath must end with a /
    ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"],  // Set [] to allow all IP addresses
                                    // or add a specific IPv4 of 192.168.1.5 :
                                    // ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.1.5"],
                                    // or IPv4 range of 192.168.3.0 --> 192.168.3.15 use CIDR format :
                                    // ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.3.0/28"],

    useHttps: false,            // Support HTTPS or not, default "false" will use HTTP
    httpsPrivateKey: "",    // HTTPS private key path, only require when useHttps is true
    httpsCertificate: "",   // HTTPS Certificate path, only require when useHttps is true

    language: "en",
    locale: "en-US",
    logLevel: ["INFO", "LOG", "WARN", "ERROR"], // Add "DEBUG" for even more logging
    timeFormat: 12,
    units: "imperial",

    modules: [
        { //40
            module: "alert",
        },
        {
            module: "updatenotification",
            position: "top_bar"
        },
        {
            module: "clock",
            position: "top_left"
        }, //50
        /* 
        {
            module: "calendar",
            position: "top_left",
            config: {
                    broadcastPastEvents: true, // <= IMPORTANT to see past events
                    calendars: [
                    {
                    url: "webcal://www.calendarlabs.com/ical-calendar/ics/76/US_Holidays.ics",
                    symbol: "us_holiday", // <= RECOMMENDED to assign name  line 60
                    },
                    {
                    url: "https://calendar.google.com/calendar/ical/[REDACTED]/private-[REDACTED]/basic.ics",
                    calendarID: "[REDACTED]",
                    name: "jeff_cal",
                    },
                    {
                    url: "https://calendar.google.com/calendar/ical/[REDACTED]group.calendar.google.com/private-[REDACTED]/basic.ics",
                    calendarID: "[REDACTED]@group.calendar.google.com",
                    name: "kids_cal",
                    },
                ]
            }
        },*/
        {
            module: 'MMM-GoogleCalendar',
            header: "Family Events",
            position: "top_left",
            config: {
            calendars: [
                {
                symbol: "calendar-week",
                calendarID: "[REDACTED]"
                },
                    {
                symbol: "",
                calendarID: "[REDACTED]@group.calendar.google.com"
                },
                {
                symbol: "",
                calendarID: "[REDACTED]@group.calendar.google.com"
                },
                {
                symbol: "",
                calendarID: "[REDACTED]@group.calendar.google.com"
                }
                ],
            }
        },
        /*{
            module: "MMM-CalendarExt3", //70
            position: "bottom_bar",
            title: "",
            config: {
                mode: "week",
                instanceId: "basicCalendar",
                locale: 'en-USE',
                maxEventLines: 5,
                firstDayOfWeek: 0,
                calendarSet: ['us_holiday', 'jeff_cal'],
                weekIndex: -1,
                weeksInView: 3
                }
        },
        {
            module: "compliments",
            position: "lower_third"
        },*/
        {
            module: "weather",
            position: "top_right",
            config: {
                weatherProvider: "openweathermap",
                type: "current",
                location: "Syracuse",
                locationID: "5782391", //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city
                apiKey: "07248d5e2cfb5dd2a1f0cd68943d1953"
            }
        },
        {
            module: "weather",
            position: "top_right",
            header: "Weather Forecast",
            config: {
                weatherProvider: "openweathermap",
                type: "forecast",
                location: "Syracuse",
                locationID: "5782391", //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city
                apiKey: "07248d5e2cfb5dd2a1f0cd68943d1953"
            }
        },
/*      {
            module: "newsfeed",
            position: "bottom_bar",
            config: {
                feeds: [
                    {
                        title: "New York Times",
                        url: "https://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml"
                    }
                ],
                showSourceTitle: true,
                showPublishDate: true,
                broadcastNewsFeeds: true,
                broadcastNewsUpdates: true
            }
        },*/
    ]
};

/*************** DO NOT EDIT THE LINE BELOW ***************/
if (typeof module !== "undefined") { module.exports = config; }
jwig22 commented 4 months ago

I reverted to v2.23.0 of MagicMirror and got the basic calendar to load in my Google Calendar events. I will try tomorrow to see if that fixed my issues with this module as well. Fingers crossed that the version change will fix it.

jwig22 commented 4 months ago

Happy to report that reverting back to v2.23.0 fixed the errors I was getting in this module. Something is wrong with the v2.26.0 of MM and how it fetches calendars.