MMM-Bring
MMM-Bring copied to clipboard
Bring stopped working.
Hi, after several months of Bring working without a hitch I noticed that the magic mirror display was not updating to reflect what was showing on the Bring App on my mobile. Restarted pi and all items work OK but Bring not showing anything on MM. Mobile phone App still working fine. The startup logs show a certificate error (see below) and other errors but its not clear to a novice coder what this all means. Hope someone can help or give me a direction to explore this issue.
[email protected] start /home/pi/MagicMirror DISPLAY="${DISPLAY:=:0}" ./node_modules/.bin/electron js/electron.js [07.10.2021 16:43.17.965] [LOG] Starting MagicMirror: v2.15.0 [07.10.2021 16:43.17.978] [LOG] Loading config ... [07.10.2021 16:43.17.997] [LOG] Loading module helpers ... [07.10.2021 16:43.19.144] [LOG] Initializing new module helper ... [07.10.2021 16:43.19.146] [LOG] Module helper loaded: MMM-Wallpaper [07.10.2021 16:43.19.151] [LOG] No helper found for module: clock. [07.10.2021 16:43.19.154] [LOG] No helper found for module: calendar_monthly. [07.10.2021 16:43.19.692] [LOG] Initializing new module helper ... [07.10.2021 16:43.19.693] [LOG] Module helper loaded: calendar [07.10.2021 16:43.19.695] [LOG] No helper found for module: weather. [07.10.2021 16:43.19.699] [LOG] No helper found for module: MMM-WiFiPassword. [07.10.2021 16:43.19.933] [LOG] Initializing new module helper ... [07.10.2021 16:43.19.935] [LOG] Module helper loaded: MMM-Bring [07.10.2021 16:43.19.937] [LOG] All module helpers loaded. [07.10.2021 16:43.20.240] [LOG] Starting server on port 8080 ... [07.10.2021 16:43.20.287] [LOG] Server started ... [07.10.2021 16:43.20.289] [LOG] Connecting socket for: MMM-Wallpaper [07.10.2021 16:43.20.291] [LOG] Starting node helper for: MMM-Wallpaper [07.10.2021 16:43.20.312] [LOG] Connecting socket for: calendar [07.10.2021 16:43.20.315] [LOG] Starting node helper for: calendar [07.10.2021 16:43.20.318] [LOG] Connecting socket for: MMM-Bring [07.10.2021 16:43.20.320] [LOG] Sockets connected & modules started ... [07.10.2021 16:43.20.941] [LOG] Launching application. [07.10.2021 16:43.29.454] [LOG] Create new calendar fetcher for url: http://calendar.google.com/calendar/ical/tonyjubb123%40gmail.com/public/basic.ics - Interval: 300000 [07.10.2021 16:43.31.392] [INFO] Calendar-Fetcher: Broadcasting 10 events. [07.10.2021 16:43.32.734] [ERROR] (node:23613) UnhandledPromiseRejectionWarning: Error: certificate has expired at TLSSocket.onConnectSecure (_tls_wrap.js:1501:34) at TLSSocket.emit (events.js:315:20) at TLSSocket._finishInit (_tls_wrap.js:936:8) at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:710:12) [07.10.2021 16:43.32.736] [ERROR] (node:23613) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag
--unhandled-rejections=strict
(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2) [07.10.2021 16:43.32.738] [ERROR] (node:23613) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
I just discovered that my MagicMirror is experiencing the same issue. Haven't had a chance to dig in yet, but I'll take a look when I get a minute.
It looks like this API request is the one that causes the failure in BringClient.js
:
return axios.get("https://web.getbring.com/locale/articles." + locale + ".json")
you can see more details about the failure by chaining a .catch(error => console.error(error))
handler onto the end of that axios call.
The complicated part is that it seems like the error message reported by Axios isn't accurate ("certificate has expired"). I'm able to successfully curl that API endpoint:
curl https://web.getbring.com/locale/articles.en-US.json
BUT the json that comes back in the response has two duplicate keys, which means that it can't be turned into a javascript object. This is where I think the actual breakdown is happening.
The duplicate keys in the JSON response I'm seeing are:
"Eigene Artikel":"Own Items",
"Zuletzt verwendet":"Recently Used"
If I manually remove those those duplicate key/value pairs from the JSON response and then hardcode the repaired json object as the return value of the BringClient.getArticles()
method, then everything works again!
I'll do a little more experimenting to see if the error handling can be adjusted to deal with these duplicate keys in the JSON response...
Also... I might be able to get to it a little sooner if we could get a Hacktoberfest tag on this repo 😜
@evanhsu Thanks for your input. I have tried your changes to BringClient.js and this has allowed the Bring information from the phone App to be displayed on the MagicMirror as previously.
However any of the items selected in Bring phone App using the provided standard Bring items shows the correct graphic on MM but the description is in German. The locale was set (and still is) in the .css file to en-GB but the description text for the standard items display in German. Any bespoke items created on the App are worded correctly and in the right language on MM but the block text graphic (allocated automatically when creating the item on the app) doesn't show only a small square is displayed.
Everything on the mobile phone App displays as expected.
Any further help or pointers on possible issues would be gratefully received.
Note the chicken, apple and beans!
@Old-Engineer Thanks for testing it out! I'm able to see the exact behavior you described 👍🏻 My original shopping list included only "bespoke" items so I didn't see the "language mismatch" behavior before.
I'm confident that the root cause of the current issue is that this request is still failing consistently: return axios.get("https://web.getbring.com/locale/articles." + locale + ".json")
That endpoint is supposed to return a mapping of item names from german to their locale
translations. The changes I've added so far only expose the error and allow the application to continue without that info, but the root failure still exists.
I'll continue to poke at it - I'm able to get a successful response from that endpoint using curl but not axios, so I'm currently investigating whether axios is adding additional headers that the api doesn't like. It's all trial and error at this point because it looks like the Bring! API isn't intended for 3rd-party access:
https://www.getbring.com/help-center-main-categories/further-devices
Oh well, looks like I have not been watching my own repository on Github, sorry for not answering..
I have the same issue, it's not working. This is the error, hpoe you can fix this.
05.11.2021 17:42.22.885] [ERROR] Error: Request failed with status code 404 at createError (/home/pi/MagicMirror/modules/MMM-Bring/node_modules/axios/lib/core/createError.js:16:15) at settle (/home/pi/MagicMirror/modules/MMM-Bring/node_modules/axios/lib/core/settle.js:17:12) at IncomingMessage.handleStreamEnd (/home/pi/MagicMirror/modules/MMM-Bring/node_modules/axios/lib/adapters/http.js:269:11) at IncomingMessage.emit (events.js:327:22) at endReadableNT (internal/streams/readable.js:1327:12) at processTicksAndRejections (internal/process/task_queues.js:80:21) { config: { url: '/bringlists/undefined', method: 'get', headers: { Accept: 'application/json, text/plain, /', Authorization: 'Bearer eyJraWQiOiJwcm9kX2FjY2Vzc3Rva2VuXzIwMjAtMDUtMTEiLCJhbGciOiJIUzUxMiJ9.eyJleHAiOjE2MzY1ODA0NjUsInN1YiI6Imdsb2JhbHByb2R1Y3Rpb25zQGdtYWlsLmNvbSIsInJvbGVzIjoiUk9MRV9VU0VSIiwicHJpdmF0ZVV1aWQiOiI0MTU3NTFmNi0yNDUwLTQ2ZjYtOGMwNC0wYzNmYWM0NWRiZmMifQ.E2y9PMSOzSmuRcVFmdMzZ2L6mjxUetASbKI_zwJoS7J2kbSdNbsB5U-c3BtmNmmyBnQzX498F_aw28EjbX5zVQ', 'x-bring-api-key': 'cof4Nc6D8saplXjE3h3HXqHH8m7VU2i1Gs0g85Sp', 'User-Agent': 'axios/0.21.2' }, baseURL: 'https://api.getbring.com/rest/v2/', transformRequest: [ [Function: transformRequest] ], transformResponse: [ [Function: transformResponse] ], timeout: 0, adapter: [Function: httpAdapter], xsrfCookieName: 'XSRF-TOKEN', xsrfHeaderName: 'X-XSRF-TOKEN', maxContentLength: -1, maxBodyLength: -1, validateStatus: [Function: validateStatus], transitional: { silentJSONParsing: true, forcedJSONParsing: true, clarifyTimeoutError: false }, data: undefined }, request: <ref *1> ClientRequest { _events: [Object: null prototype] { socket: [Function (anonymous)], abort: [Function (anonymous)], aborted: [Function (anonymous)], connect: [Function (anonymous)], error: [Function (anonymous)], timeout: [Function (anonymous)], prefinish: [Function: requestOnPrefinish] }, _eventsCount: 7, _maxListeners: undefined, outputData: [], outputSize: 0, writable: true, destroyed: false, _last: true, chunkedEncoding: false, shouldKeepAlive: false, _defaultKeepAlive: true, useChunkedEncodingByDefault: false, sendDate: false, _removedConnection: false, _removedContLen: false, _removedTE: false, _contentLength: 0, _hasBody: true, _trailer: '', finished: true, _headerSent: true, socket: TLSSocket { _tlsOptions: [Object], _secureEstablished: true, _securePending: false, _newSessionPending: false, _controlReleased: true, secureConnecting: false, _SNICallback: null, servername: 'api.getbring.com', alpnProtocol: false, authorized: true, authorizationError: null, encrypted: true, _events: [Object: null prototype], _eventsCount: 10, connecting: false, _hadError: false, _parent: null, _host: 'api.getbring.com', _readableState: [ReadableState], _maxListeners: undefined, _writableState: [WritableState], allowHalfOpen: false, _sockname: null, _pendingData: null, _pendingEncoding: '', server: undefined, _server: null, ssl: [TLSWrap], _requestCert: true, _rejectUnauthorized: true, parser: null, _httpMessage: [Circular *1], [Symbol(res)]: [TLSWrap], [Symbol(verified)]: true, [Symbol(pendingSession)]: null, [Symbol(async_id_symbol)]: 1430, [Symbol(kHandle)]: [TLSWrap], [Symbol(kSetNoDelay)]: false, [Symbol(lastWriteQueueSize)]: 0, [Symbol(timeout)]: null, [Symbol(kBuffer)]: null, [Symbol(kBufferCb)]: null, [Symbol(kBufferGen)]: null, [Symbol(kCapture)]: false, [Symbol(kBytesRead)]: 0, [Symbol(kBytesWritten)]: 0, [Symbol(connect-options)]: [Object], [Symbol(RequestTimeout)]: undefined }, _header: 'GET /rest/v2/bringlists/undefined HTTP/1.1\r\n' + 'Accept: application/json, text/plain, /\r\n' + 'Authorization: Bearer eyJraWQiOiJwcm9kX2FjY2Vzc3Rva2VuXzIwMjAtMDUtMTEiLCJhbGciOiJIUzUxMiJ9.eyJleHAiOjE2MzY1ODA0NjUsInN1YiI6Imdsb2JhbHByb2R1Y3Rpb25zQGdtYWlsLmNvbSIsInJvbGVzIjoiUk9MRV9VU0VSIiwicHJpdmF0ZVV1aWQiOiI0MTU3NTFmNi0yNDUwLTQ2ZjYtOGMwNC0wYzNmYWM0NWRiZmMifQ.E2y9PMSOzSmuRcVFmdMzZ2L6mjxUetASbKI_zwJoS7J2kbSdNbsB5U-c3BtmNmmyBnQzX498F_aw28EjbX5zVQ\r\n' + 'x-bring-api-key: cof4Nc6D8saplXjE3h3HXqHH8m7VU2i1Gs0g85Sp\r\n' + 'User-Agent: axios/0.21.2\r\n' + 'Host: api.getbring.com\r\n' + 'Connection: close\r\n' + '\r\n', _keepAliveTimeout: 0, _onPendingData: [Function: noopPendingOutput], agent: Agent { _events: [Object: null prototype], _eventsCount: 2, _maxListeners: undefined, defaultPort: 443, protocol: 'https:', options: [Object], requests: {}, sockets: [Object], freeSockets: {}, keepAliveMsecs: 1000, keepAlive: false, maxSockets: Infinity, maxFreeSockets: 256, scheduling: 'fifo', maxTotalSockets: Infinity, totalSocketCount: 1, maxCachedSessions: 100, _sessionCache: [Object], [Symbol(kCapture)]: false }, socketPath: undefined, method: 'GET', maxHeaderSize: undefined, insecureHTTPParser: undefined, path: '/rest/v2/bringlists/undefined', _ended: true, res: IncomingMessage { _readableState: [ReadableState], _events: [Object: null prototype], _eventsCount: 3, _maxListeners: undefined, socket: [TLSSocket], httpVersionMajor: 1, httpVersionMinor: 1, httpVersion: '1.1', complete: true, headers: [Object], rawHeaders: [Array], trailers: {}, rawTrailers: [], aborted: false, upgrade: false, url: '', method: null, statusCode: 404, statusMessage: '', client: [TLSSocket], _consuming: false, _dumped: false, req: [Circular *1], responseUrl: 'https://api.getbring.com/rest/v2/bringlists/undefined', redirects: [], [Symbol(kCapture)]: false, [Symbol(RequestTimeout)]: undefined }, aborted: false, timeoutCb: null, upgradeOrConnect: false, parser: null, maxHeadersCount: null, reusedSocket: false, host: 'api.getbring.com', protocol: 'https:', _redirectable: Writable { _writableState: [WritableState], _events: [Object: null prototype], _eventsCount: 2, _maxListeners: undefined, _options: [Object], _ended: true, _ending: true, _redirectCount: 0, _redirects: [], _requestBodyLength: 0, _requestBodyBuffers: [], _onNativeResponse: [Function (anonymous)], _currentRequest: [Circular *1], _currentUrl: 'https://api.getbring.com/rest/v2/bringlists/undefined', [Symbol(kCapture)]: false }, [Symbol(kCapture)]: false, [Symbol(kNeedDrain)]: false, [Symbol(corked)]: 0, [Symbol(kOutHeaders)]: [Object: null prototype] { accept: [Array], authorization: [Array], 'x-bring-api-key': [Array], 'user-agent': [Array], host: [Array] } }, response: { status: 404, statusText: '', headers: { date: 'Fri, 05 Nov 2021 16:42:22 GMT', 'content-length': '0', connection: 'close', server: 'Apache/2.4.51 (Amazon) OpenSSL/1.0.2k-fips', vary: 'Origin,Accept-Encoding', 'access-control-allow-credentials': 'true', 'access-control-expose-headers': 'Access-Control-Allow-Origin,Access-Control-Allow-Credentials', 'x-amzn-trace-id': 'Root=1-61855eee-22a542973bbfa3f151e4aa3f;', 'cache-control': 'no-cache, no-store, max-age=0, must-revalidate', pragma: 'no-cache', expires: '0', 'strict-transport-security': 'max-age=31536000 ; includeSubDomains', 'x-xss-protection': '1; mode=block', 'x-frame-options': 'DENY', 'x-content-type-options': 'nosniff' }, config: { url: '/bringlists/undefined', method: 'get', headers: [Object], baseURL: 'https://api.getbring.com/rest/v2/', transformRequest: [Array], transformResponse: [Array], timeout: 0, adapter: [Function: httpAdapter], xsrfCookieName: 'XSRF-TOKEN', xsrfHeaderName: 'X-XSRF-TOKEN', maxContentLength: -1, maxBodyLength: -1, validateStatus: [Function: validateStatus], transitional: [Object], data: undefined }, request: <ref *1> ClientRequest { _events: [Object: null prototype], _eventsCount: 7, _maxListeners: undefined, outputData: [], outputSize: 0, writable: true, destroyed: false, _last: true, chunkedEncoding: false, shouldKeepAlive: false, _defaultKeepAlive: true, useChunkedEncodingByDefault: false, sendDate: false, _removedConnection: false, _removedContLen: false, _removedTE: false, _contentLength: 0, _hasBody: true, _trailer: '', finished: true, _headerSent: true, socket: [TLSSocket], _header: 'GET /rest/v2/bringlists/undefined HTTP/1.1\r\n' + 'Accept: application/json, text/plain, /\r\n' + 'Authorization: Bearer eyJraWQiOiJwcm9kX2FjY2Vzc3Rva2VuXzIwMjAtMDUtMTEiLCJhbGciOiJIUzUxMiJ9.eyJleHAiOjE2MzY1ODA0NjUsInN1YiI6Imdsb2JhbHByb2R1Y3Rpb25zQGdtYWlsLmNvbSIsInJvbGVzIjoiUk9MRV9VU0VSIiwicHJpdmF0ZVV1aWQiOiI0MTU3NTFmNi0yNDUwLTQ2ZjYtOGMwNC0wYzNmYWM0NWRiZmMifQ.E2y9PMSOzSmuRcVFmdMzZ2L6mjxUetASbKI_zwJoS7J2kbSdNbsB5U-c3BtmNmmyBnQzX498F_aw28EjbX5zVQ\r\n' + 'x-bring-api-key: cof4Nc6D8saplXjE3h3HXqHH8m7VU2i1Gs0g85Sp\r\n' + 'User-Agent: axios/0.21.2\r\n' + 'Host: api.getbring.com\r\n' + 'Connection: close\r\n' + '\r\n', _keepAliveTimeout: 0, _onPendingData: [Function: noopPendingOutput], agent: [Agent], socketPath: undefined, method: 'GET', maxHeaderSize: undefined, insecureHTTPParser: undefined, path: '/rest/v2/bringlists/undefined', _ended: true, res: [IncomingMessage], aborted: false, timeoutCb: null, upgradeOrConnect: false, parser: null, maxHeadersCount: null, reusedSocket: false, host: 'api.getbring.com', protocol: 'https:', _redirectable: [Writable], [Symbol(kCapture)]: false, [Symbol(kNeedDrain)]: false, [Symbol(corked)]: 0, [Symbol(kOutHeaders)]: [Object: null prototype] }, data: '' }, isAxiosError: true, toJSON: [Function: toJSON]
Is there a solution already - still the same problem - nothing is shown
Unfortunately not as the Bring-Team changed their API. Maybe somebody with a better knowledge about OAuth/OIDC can make it work again
I’ve been using this app and module for a few months. When it works it’s great. There was an issue a few weeks ago when the HTTPS connections no longer worked due to problem with a verifying site. This was resolved by another Bring user (https://github.com/evanhsu) to use HHTP connections instead and has worked until the last few weeks. Now the module does not work at all although the app still works well. Apparently the app does not have an official API. I do not have sufficient knowledge of node.js to begin to resolve this issue and have therefore resorted to using the google sheets module as a reminder list. It’s not as easy to use but it is reliable and uses the google official API.
Hope this is informative and possibly helpful.