composio icon indicating copy to clipboard operation
composio copied to clipboard

[Bug]: GMAIL_FETCH_EMAILS returns empty messages

Open a9a4k opened this issue 1 month ago • 5 comments

SDK Language

TypeScript / Node.js SDK (@composio/core)

SDK Version

0.2.3

Runtime Environment

Node.js v22

Environment

Production Deployment

Describe the Bug

The GMAIL_FETCH_EMAILS action consistently returns an empty messages array despite:

  • Returning successful: true
  • Having a valid resultSizeEstimate (e.g., 201 emails)
  • Providing a valid nextPageToken

Expected Behavior: Should return an array of email messages matching the query parameters. Actual Behavior: Returns empty array messages: [] while indicating success.

Steps to Reproduce

  1. Set up Gmail integration with Composio
  2. Create a connected account with Gmail OAuth
  3. Execute GMAIL_FETCH_EMAILS with entity ID and parameters
  4. Observe empty messages array despite existing emails

Minimal Reproducible Example

curl -X POST "https://backend.composio.dev/api/v3/tools/execute/GMAIL_FETCH_EMAILS" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: <COMPOSIO_API_KEY>" \
  -d '{
    "user_id": "<USER_ID>",
    "arguments": {
      "label_ids": ["UNREAD"],
      "max_results": 10
    }
  }'

Error Output / Stack Trace

no errors, returns empty array as response

Reproducibility

  • [x] Always reproducible
  • [ ] Intermittent / Sometimes
  • [ ] Happened once, can’t reproduce

Additional Context or Screenshots

No response

a9a4k avatar Nov 19 '25 17:11 a9a4k

Seems like the issue gets resolved when setting verbose to false when calling the tool, i.e.

{
  "max_results": 10,
  "verbose": false
}

So the issue is with the verbose: true mode, which is also the default

a9a4k avatar Nov 19 '25 19:11 a9a4k

Hey @a9a4k, could you share more details about this snippet:

const result = await tools.GMAIL_FETCH_EMAILS.execute({
  context: {
    label_ids: ['UNREAD'],
    max_results: 10
  }
});

Doc to refer: https://docs.composio.dev/docs/executing-tools#direct-tool-execution

Uday-sidagana avatar Nov 19 '25 20:11 Uday-sidagana

Hi @Uday-sidagana , ye, apologies for the confusion, I updated to curl command. I asked LLM to create typescript snippet out of it when creating ticket, but seems like it didn't quite get it. This snippet reproduces the issue

curl -X POST "https://backend.composio.dev/api/v3/tools/execute/GMAIL_FETCH_EMAILS" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: <COMPOSIO_API_KEY>" \
  -d '{
    "user_id": "<USER_ID>",
    "arguments": {
      "label_ids": ["UNREAD"],
      "max_results": 10
    }
  }'

a9a4k avatar Nov 20 '25 08:11 a9a4k

Got it @a9a4k, the CUrl request you’ve shared works fine on our end. Could you share the exact response payload, including the logId or requestId?

Uday-sidagana avatar Nov 20 '25 08:11 Uday-sidagana

Sure, here is the response

{"data":{"messages":[],"nextPageToken":"12044410112852341612","resultSizeEstimate":201},"successful":true,"error":null,"log_id":"log_KnFsz_vX7N_L"}

a9a4k avatar Nov 20 '25 08:11 a9a4k

I think I might have misconfigure the Google Client, so closing the issue

a9a4k avatar Dec 01 '25 18:12 a9a4k