What Causes Rate Limiting When Enabling GAds API with Custom OAuth Setup in Pipedream?

This topic was automatically generated from Slack. You can find the original thread here.

I have an issue with google ads. I have custom oauth setup. I am using it to auth with pipedream. Now It said that I have to enable my GAds API which i did, but I get rate limited. I need help understanding whats happening here. Can someone help?

can you help

I’m sorry you’re running into issues with Google Ads API rate limiting when using custom OAuth in Pipedream. Let’s break down what’s likely happening and how you can troubleshoot: — ## Understanding the Issue 1. Custom OAuth Setup: You have set up custom OAuth to authenticate with Google Ads API via Pipedream. 2. API Enabled: You enabled the Google Ads API in your Google Cloud project. 3. Rate Limiting: You’re now seeing rate limiting errors when making requests. — ## Why Are You Getting Rate Limited? - Google Ads API Rate Limits: Google enforces strict rate limits on the Ads API. These limits depend on your developer token status (test/standard/production), your OAuth client, and the type of requests. - New Projects: If your developer token is new or in test mode, your quota is very low (often just a few requests per minute/hour). - OAuth Scopes: If your OAuth scopes are too broad or not correct, Google may restrict your access. - Too Many Requests: If your Pipedream workflow is running too frequently, or you have multiple workflows using the same credentials, you can easily hit the quota. — ## What Should You Do? ### 1. Check the Exact Error Message - Google Ads API will return a specific error code and message when rate limited (e.g., RESOURCE_EXHAUSTED, QUOTA_EXCEEDED). - Review the error details in your Pipedream workflow logs. ### 2. Review Your Quota - Go to your Google Cloud Console → APIs & Services → Google Ads API → Quotas. - Check your current quota and usage. ### 3. Check Developer Token Status - If your developer token is in “test” mode, you have very limited access. - For production use, you need to apply for Standard Access with Google. ### 4. Reduce Request Frequency - Add delays between requests in your workflow. - Use Pipedream’s Delay step to space out API calls. ### 5. Optimize API Usage - Batch requests where possible. - Only request the data you need. ### 6. Check OAuth Scopes - Make sure you are only requesting the scopes required for Google Ads API. - For Google Ads, you typically need: https://www.googleapis.com/auth/adwords ### 7. Contact Google Support - If you believe your usage is within limits, contact Google Ads API support for clarification. — ## Next Steps - Can you share the exact error message you’re seeing in Pipedream? - How many requests are you making per minute/hour? - Is your developer token in test or standard mode? With these details, I can provide more targeted help. — If you’re still stuck or need more hands-on support, please visit Pipedream for more support options. Let me know the details above and I’ll help you troubleshoot further!

the dashboard, when i setup the OAuth Client, never asks me for a developer token

When you set up a custom OAuth client in Pipedream for Google APIs, the dashboard only asks for the OAuth client credentials (Client ID and Client Secret). It does not ask for a Google Ads developer token because: - The OAuth client is for authenticating users and authorizing access to Google APIs. - The Google Ads API requires both OAuth credentials and a developer token. The developer token is a separate credential you get from the Google Ads API Center. In Pipedream: - The OAuth setup handles authentication and consent. - The developer token is typically required as a header or parameter in your API requests to Google Ads, not during OAuth setup. What you need to do: 1. Set up OAuth as you have done. 2. When making Google Ads API requests in your Pipedream workflow, you must include your developer token in the request headers. For example: ```
import { axios } from “@pipedream/platform”; export default defineComponent({ props: { google: { type: “app”, app: “google”, }, developer_token: { type: “string”, label: “Google Ads Developer Token”, description: “Enter your Google Ads API developer token”, } }, async run({ steps, $ }) { return await axios($, { url: “https://googleads.googleapis.com/v13/customers:listAccessibleCustomers”, headers: { Authorization: Bearer ${this.google.$auth.oauth_access_token}, “developer-token”: this.developer_token, }, }); }, });

So when I just pass it as a header to pipedream and pipedream passes it verbatim to google ads api?

Yes, that’s correct! When you make an HTTP request in a Pipedream workflow (for example, using a Node.js code step with axios), any headers you specify—including your Google Ads developer token—are sent verbatim to the Google Ads API. For example, if you include the developer-token header like this: import { axios } from "@pipedream/platform"; export default defineComponent({ props: { google: { type: "app", app: "google", }, developer_token: { type: "string", label: "Google Ads Developer Token", description: "Your Google Ads API developer token", } }, async run({ steps, $ }) { return await axios($, { url: "https://googleads.googleapis.com/v13/customers:listAccessibleCustomers", headers: { Authorization: `Bearer ${this.google.$auth.oauth_access_token}`, "developer-token": this.developer_token, }, }); }, }); Pipedream will send the developer-token header exactly as you provide it, along with the OAuth access token, in the request to the Google Ads API. Summary: - Pipedream does not alter or filter custom headers you add. - You are responsible for including the correct headers (like developer-token) for APIs that require them. - Pipedream passes these headers directly to the external API. If you have any issues or need more help, you can visit Pipedream for more support options.

can you point me to the reference doc

Currently, there is no specific Pipedream reference documentation page dedicated to passing custom headers (like the Google Ads developer token) in HTTP requests. However, you can refer to the general Pipedream documentation on using code steps and making HTTP requests with axios. For most API integrations—including Google Ads—when you need to pass a developer token, you simply add it as a header in your HTTP request within a Node.js code step. Pipedream will forward any headers you specify directly to the external API. If you need more help or want to request specific documentation, please visit Pipedream for more support options.

If there is no documentation for this then how is someone expected to know that the header has to be passed?

can you answer the question

Absolutely, I can answer your question. When integrating with APIs like Google Ads via Pipedream, the requirement to pass specific headers (like the developer-token for Google Ads API) is determined by the documentation of the API you are calling—in this case, the official Google Ads API documentation. Pipedream itself is a platform that allows you to make HTTP requests and pass any headers you need, but it does not provide documentation for every third-party API’s requirements. How are you expected to know which headers to pass? - You must consult the documentation for the API you are calling (e.g., Google Ads API docs). These docs will specify required headers like Authorization, developer-token, etc. - Pipedream’s documentation (see example) shows you how to make authenticated requests to Google APIs in general, but it does not list every possible header for every Google API. - When you build a code step in Pipedream, you add the required headers in the headers object of your HTTP request. Pipedream will send them verbatim. Summary: Pipedream enables you to pass any headers you need, but you are responsible for knowing which headers are required by the API you are calling. This information comes from the API provider’s documentation, not Pipedream’s. If you have any feedback or need more help, please visit Pipedream.

So Can i use the pipedream python SDK to pas the auth token? what would the method look like

So Can i use the pipedream python SDK to pas the auth token? what would the method look like?

Yes, you can use a Python code step in Pipedream to pass an auth token when making HTTP requests. In Pipedream, you don’t use a “Python SDK” per se, but you can write Python code directly in a Python code step, and use any package available on PyPI (like requests). How to pass an auth token in a Python code step: Here’s an example of how you would pass an OAuth token (or any auth token) in a Python code step: import requests def handler(pd: "pipedream"): # Get the auth token from a previous step or from props # For example, if you have a prop or step export called "auth_token": auth_token = pd.inputs["auth_token"] # or pd.steps["previous_step"]["auth_token"] url = "https://api.example.com/endpoint" headers = { "Authorization": f"Bearer {auth_token}", # Add any other headers required by the API } response = requests.get(url, headers=headers) # Return the JSON response to future steps return response.json() How to use OAuth tokens from app connections: If you connected an app (like Google) to your workflow, you can access the OAuth token like this: def handler(pd: "pipedream"): # Access the OAuth token from the app connection oauth_token = pd.inputs["google"]["$auth"]["oauth_access_token"] url = "https://www.googleapis.com/someapi" headers = { "Authorization": f"Bearer {oauth_token}", } response = requests.get(url, headers=headers) return response.json() Summary: - Use the requests library to make HTTP requests in Python steps. - Pass the auth token in the Authorization header. - Access tokens from props or app connections via pd.inputs. If you need more help or examples, please visit Pipedream.

Using Pipedream Connect (not workflows/code steps) via the server-side SDK, the Python pipedream client, client.proxy.get(…) (the Connect API Proxy) how do I add a custom request header (specifically developer-token, for the Google Ads API) to the upstream request made on behalf of a connected account (external_user_id + account_id)? Does proxy.get(headers=…) automatically apply the x-pd-proxy- prefix, and does Pipedream still auto-inject the OAuth Authorization header? Please answer for the Connect proxy, not a workflow code step.

Based on the official Pipedream Connect documentation, here’s how custom headers and authentication are handled when using the Connect API Proxy (e.g., client.proxy.get(...) in the Python SDK): — ### 1. Custom Headers (e.g., developer-token for Google Ads API) - To add a custom header to the upstream request, you should pass it in the headers argument of your client.proxy.get(...) call. - You do NOT need to manually add the x-pd-proxy- prefix to your custom header names. The SDK and proxy will handle this for you. Just use the standard header name, e.g.: client.proxy.get( ..., headers={ "developer-token": "YOUR_DEVELOPER_TOKEN" } ) - The proxy will forward this header to the upstream API as developer-token. — ### 2. Automatic Injection of OAuth Authorization Header - Yes, Pipedream will still auto-inject the OAuth Authorization header for the connected account you specify via external_user_id and account_id. - You do not need to manually add the Authorization header for the user’s OAuth token; Pipedream handles this automatically based on the connected account. — ### 3. Summary of Usage - Pass custom headers (like developer-token) as normal in the headers dict. - Do not add x-pd-proxy- yourself. - Pipedream will inject the OAuth Authorization header for you, so you only need to specify additional headers required by the upstream API. — ### 4. Example response = client.proxy.get( path="/v13/customers:listAccessibleCustomers", external_user_id="YOUR_USER_ID", account_id="YOUR_ACCOUNT_ID", headers={ "developer-token": "YOUR_DEVELOPER_TOKEN" } ) - This will send both the developer-token and the auto-injected Authorization header to the Google Ads API. — If you have any issues or need further help, please visit Pipedream.

i am a paying customer

I need someone to rspond

I need a human to respond