[PR #10] [MERGED] Update gapi.ts #81

Closed
opened 2026-02-27 04:59:06 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/guyzyl/whatsapp-contact-sync/pull/10
Author: @guyzyl
Created: 8/21/2022
Status: Merged
Merged: 8/21/2022
Merged by: @guyzyl

Base: mainHead: catch-google-upload-error


📝 Commits (1)

📊 Changes

1 file changed (+8 additions, -9 deletions)

View changed files

📝 server/src/gapi.ts (+8 -9)

📄 Description

Add try catch to google contact photo upload to avoid errors that crash the app such as:

GaxiosError: Invalid photo format at Gaxios._request (/app/server/node_modules/gaxios/build/src/gaxios.js:130:23) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async OAuth2Client.requestAsync (/app/server/node_modules/google-auth-library/build/src/auth/oauth2client.js:368:18) {
    url: 'https://people.googleapis.com/v1/people/REDACTED:updateContactPhoto',
    method: 'PATCH',
    userAgentDirectives: [
        {
            product: 'google-api-nodejs-client',
            version: '6.0.0',
            comment: 'gzip'
        }
    ],
    paramsSerializer: [Function (anonymous)],
    data: {
        photoBytes: 'REDACTED'
    },
    headers: {
        'x-goog-api-client': 'gdcl/6.0.0 gl-node/18.7.0 auth/8.1.0',
        'Accept-Encoding': 'gzip',
        'User-Agent': 'google-api-nodejs-client/6.0.0 (gzip)',
        Authorization: 'Bearer REDACTED',
        'Content-Type': 'application/json',
        Accept: 'application/json'
    },
    params: {},
    validateStatus: [Function (anonymous)],
    retry: true,
    body: '{"photoBytes":"REDACTED"}',
    responseType: 'json',
    retryConfig: {
        currentRetryAttempt: 0,
        retry: 3,
        httpMethodsToRetry: [ 'GET', 'HEAD', 'PUT', 'OPTIONS', 'DELETE' ],
        noResponseRetries: 2,
        statusCodesToRetry: [ [ 100, 199 ], [ 429, 429 ], [ 500, 599 ] ]
    }
},
code: 400,
errors: [
    {
        message: 'Invalid photo format',
        domain: 'global',
        reason: 'badRequest'
    }
]

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/guyzyl/whatsapp-contact-sync/pull/10 **Author:** [@guyzyl](https://github.com/guyzyl) **Created:** 8/21/2022 **Status:** ✅ Merged **Merged:** 8/21/2022 **Merged by:** [@guyzyl](https://github.com/guyzyl) **Base:** `main` ← **Head:** `catch-google-upload-error` --- ### 📝 Commits (1) - [`1677918`](https://github.com/guyzyl/whatsapp-contact-sync/commit/167791869eb4d732f7a61c77049036234c411f05) Update gapi.ts ### 📊 Changes **1 file changed** (+8 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `server/src/gapi.ts` (+8 -9) </details> ### 📄 Description Add `try catch` to google contact photo upload to avoid errors that crash the app such as: ``` GaxiosError: Invalid photo format at Gaxios._request (/app/server/node_modules/gaxios/build/src/gaxios.js:130:23) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async OAuth2Client.requestAsync (/app/server/node_modules/google-auth-library/build/src/auth/oauth2client.js:368:18) { url: 'https://people.googleapis.com/v1/people/REDACTED:updateContactPhoto', method: 'PATCH', userAgentDirectives: [ { product: 'google-api-nodejs-client', version: '6.0.0', comment: 'gzip' } ], paramsSerializer: [Function (anonymous)], data: { photoBytes: 'REDACTED' }, headers: { 'x-goog-api-client': 'gdcl/6.0.0 gl-node/18.7.0 auth/8.1.0', 'Accept-Encoding': 'gzip', 'User-Agent': 'google-api-nodejs-client/6.0.0 (gzip)', Authorization: 'Bearer REDACTED', 'Content-Type': 'application/json', Accept: 'application/json' }, params: {}, validateStatus: [Function (anonymous)], retry: true, body: '{"photoBytes":"REDACTED"}', responseType: 'json', retryConfig: { currentRetryAttempt: 0, retry: 3, httpMethodsToRetry: [ 'GET', 'HEAD', 'PUT', 'OPTIONS', 'DELETE' ], noResponseRetries: 2, statusCodesToRetry: [ [ 100, 199 ], [ 429, 429 ], [ 500, 599 ] ] } }, code: 400, errors: [ { message: 'Invalid photo format', domain: 'global', reason: 'badRequest' } ] ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 04:59:06 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/whatsapp-contact-sync#81
No description provided.