- Newest
- Most votes
- Most comments
Based on the error message and details you've provided, it appears you're experiencing an OAuth authentication issue between AWS and Salesforce. The specific error "[invalid_grant] no valid scopes defined" suggests there's a problem with the OAuth scopes configuration.
The issue is likely related to the Salesforce Connected App configuration you mentioned, specifically the "No OAuth Custom Scopes defined" part. When using the client credentials flow for OAuth authentication with Salesforce, you need to define appropriate OAuth scopes that specify what permissions your application needs.
Here are some steps to troubleshoot and potentially resolve the issue:
-
In Salesforce, check the Connected App configuration and add appropriate OAuth scopes. Common scopes include "api", "refresh_token", etc., depending on what your application needs to access.
-
Verify that the client ID and client secret being used in your Lambda function match those in the Salesforce Connected App.
-
Check if there were any recent changes to the Salesforce Connected App settings, especially around OAuth configuration or IP restrictions.
-
Look at CloudWatch Logs for the Lambda function to see if there are any additional error details that might provide more context.
-
If you're using AWS Secrets Manager to store Salesforce credentials, verify that the secrets are still valid and accessible by your Lambda function.
-
Check if there have been any recent AWS service updates that might affect the integration, similar to the BOTO3 issue you experienced previously.
The error is coming from the "aiosalesforce" Python library (specifically the client_credentials_flow.py file), which is likely installed as a dependency in your Lambda function. This is not a built-in AWS library but rather a third-party Python package for interacting with Salesforce.
The timing of the failure (1:00 AM on 10/04/2025) could indicate a scheduled token refresh that failed, or possibly a change in either AWS or Salesforce that affected the integration.
Sources
how to integrate AWS glue with Salesforce using JWT bearer token | AWS re:Post
Diagnosing Salesforce IoT input stream action issues - AWS IoT Core
answered a year ago
"Verify that the client ID and client secret being used in your Lambda function match those in the Salesforce Connected App." Where do I find this in the Lambda?
"Check if there were any recent changes to the Salesforce Connected App settings, especially around OAuth configuration or IP restrictions" Network Engineer for SalesForce states nothing changed on their end. So leaning toward an AWS change but unsure how to know if they changed anything.
"If you're using AWS Secrets Manager to store Salesforce credentials, verify that the secrets are still valid and accessible by your Lambda function." How do you confirm this Secrets Manager is linked to a Lambda?
answered a year ago
Relevant content
asked 3 years ago
