This topic was automatically generated from Slack. You can find the original thread here.
I am getting this error. It was working fine yesterday and nothing changed. So why am I having this issue?
Error: Invalid Credentials
at Gaxios._request (/var/task/node_modules/gaxios/src/gaxios.ts:169:15)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async OAuth2Client.requestAsync (/var/task/node_modules/google-auth-library/build/src/auth/oauth2client.js:382:18)
at async Object.listMessages (file:///var/task/user/gmail/gmail.app.mjs:243:24)
at async Object.run (file:///var/task/user/gmail_custom_oauth/sources/common/polling.mjs:64:22)
at async /var/task/index.js:122:11
at async captureObservations (/var/task/node_modules/@lambda-v2/component-runtime/src/captureObservations.js:28:5)
at async exports.main [as handler] (/var/task/index.js:60:20)
I’m sorry to hear that you’re experiencing issues with your workflow. The error message “Invalid Credentials” suggests that there might be an issue with the authentication token for your Gmail integration. It’s possible that the token has expired or been revoked. To resolve this issue, please try the following steps: 1. Edit your workflow in the Pipedream UI. 2. Locate the step that uses the Gmail integration (it might be a trigger or an action). 3. Click on the connected Gmail account and select “Reconnect” to reauthorize the Gmail integration. If the issue persists, please visit https://pipedream.com/support for more support options.
OAuth tokens can expire, and the expiration time depends on the service provider (in this case, Google). Typically, access tokens for Google services expire after 1 hour. When using Pipedream integrations, the platform automatically handles token refreshes for you, so you shouldn’t experience frequent token expirations. However, in some cases, like if the token is revoked or there’s an issue with the refresh process, you might need to reconnect your account manually. If you continue to experience token expiration issues, please visit https://pipedream.com/support for more support options.
I apologize for the inconvenience you experienced with the token refresh. Pipedream should handle token refreshes automatically in most cases. However, if you continue to face issues, you can consider implementing a custom error handling mechanism in your workflow to detect token expiration errors and reconnect the account programmatically. If the issue persists or becomes frequent, I recommend reaching out to Pipedream support at https://pipedream.com/support for further assistance and investigation.
If your trigger is an email step, you can still implement custom error handling within the subsequent action steps in your workflow. For example, you can use try and catch blocks in your Node.js code steps to handle errors gracefully and take appropriate actions based on the error type. Here’s a simple example of using try and catch in a code step: export default defineComponent({ async run({ steps, $ }) { try { // Your code logic here } catch (error) { console.error("An error occurred:", error.message); // Perform custom error handling, e.g., send a notification to Slack // or retry the operation with a different approach } }, }); In this example, if an error occurs within the try block, the code within the catch block will be executed. You can customize the error handling logic in the catch block as needed, such as sending notifications to Slack or retrying the operation with a different approach. If you continue to face issues with error handling or need more assistance, please visit https://pipedream.com/support for more support options.