-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Closed
Labels
Description
App
Serpapi
Summary:
Error when trying to invoke the action via API.
Details:
{
"name": "TypeError",
"message": "Cannot read properties of undefined (reading 'api_key')",
"stack": "... at Object._makeRequest ... serpapi.app.mjs:47:31"
}
---
Issue Description:
When invoking the `serpapi-scrape-search` action via the Pipedream Connect API, I’m encountering a `TypeError` indicating that `api_key` is `undefined`. This suggests that the runtime code is attempting to access `configured_props.serpapi.api_key`, but it doesn’t exist in the action payload.
According to the documentation and my understanding, SerpApi is a key-based integration: the API key is securely stored in Pipedream once the account is configured via the UI under **Accounts → SerpApi**. The expectation is that, at runtime, Pipedream should automatically inject the stored key into the execution environment—meaning it shouldn’t be necessary to include an explicit `api_key` field in the `configured_props`.
Instead, it seems the action is misconfigured and trying to access credentials that are never provided explicitly, causing the runtime error.
What I’ve Already Tried:
* Verified that my SerpApi API key is properly added in the Pipedream UI (`Accounts → SerpApi`).
* Removed `authProvisionId` and `api_key` from the payload, relying on Pipedream to inject credentials.
* Ensured all required action inputs (`q`, `engine`, `num`) are provided in `configured_props`.
* The error persists every run, consistently thrown from `serpapi.app.mjs:47:31`.
---
Request / Ask of Pipedream Support:
1. **Clarify** whether the action expects `api_key` to be explicitly provided in the payload, or if it should auto-inject from the stored account.
2. If auto-injection *should* happen, please:
* Validate and fix the action's implementation to properly reference `this.serpapi.$auth.api_key` at runtime.
* Update documentation to reflect the correct usage for key-based integrations via Connect API.
3. If `api_key` must currently be passed explicitly:
* Provide examples in the Connect API docs.
* Label this as a known limitation or inconsistency with other key-based app patterns.
---
Sample Payload That Fails:
{
"id": "serpapi-scrape-search",
"external_user_id": "user-123",
"configured_props": {
"q": "best Moroccan cuisine recipes",
"engine": "google",
"num": 10
}
}
This consistently produces:
TypeError: Cannot read properties of undefined (reading 'api_key')
---
Thank you for your support in diagnosing and fixing this. Let me know if further logs or examples are helpful—I’d appreciate a resolution that aligns SerpApi’s behavior with other key-based integrations on Pipedream.
### Screenshots:
No screenshots included