PipedreamHQ / PipedreamHQ/pipedream
Connect API: /actions/run endpoint taking 6-10s for simple actions
- Dominant language
- JavaScript
- Stars
- 11.7k
- Forks
- 5.8k
- Avg merge
- 3d 10h
- Merged PRs (30d)
- 102
Description
## Description
When using the Pipedream Connect API to run actions, the POST `/connect/{project_id}/actions/run` endpoint takes **6-10 seconds** when `stash_id: ""` is included, but only **1.5 seconds** when `stash_id` is omitted.
## Root Cause Found
Sending `stash_id: ""` (empty string) to initialize a new stash causes a massive performance penalty.
| Request | Response Time |
|---------|---------------|
| Without `stash_id` | ~1.5s |
| With `stash_id: ""` | ~6-10s |
| With `stash_id: ""` | (not yet tested) |
## Environment
- API endpoint: `https://api.pipedream.com/v1/connect/{project_id}/actions/run`
- Action tested: `trengo-list-messages`
## Reproduction
**Fast request (~1.5s):**
```bash
curl -X POST 'https://api.pipedream.com/v1/connect/{project_id}/actions/run' \
-H 'Authorization: Bearer ...' \
-H 'Content-Type: application/json' \
-d '{
"id": "trengo-list-messages",
"configured_props": { ... },
"external_user_id": "..."
}'
```
**Slow request (~6-10s):**
```bash
curl -X POST 'https://api.pipedream.com/v1/connect/{project_id}/actions/run' \
-H 'Authorization: Bearer ...' \
-H 'Content-Type: application/json' \
-d '{
"id": "trengo-list-messages",
"configured_props": { ... },
"external_user_id": "...",
"stash_id": ""
}'
```
## Impact
We use `stash_id: ""` on the first action of a workflow to initialize a stash for sharing data between subsequent actions. This 5-8 second penalty on stash creation significantly impacts our workflow execution times.
## Expected Behavior
Creating a new stash (via `stash_id: ""`) should not add significant latency compared to requests without stash.
## Reference
The Pipedream Connect demo at https://pipedream.com/connect/demo?app=trengo&component=trengo-list-messages&tab=debug shows runtimes of 1-2 seconds, which matches our results when `stash_id` is omitted.
Contributor guide
Assessment
This issue has not been assessed yet.