Keepa API selection parameter ignored in Code Node (v2.1.5 Docker)

Hello n8n community,

I am having a persistent issue where the Keepa API /query (Product Finder) endpoint ignores my selection parameters when called from my n8n environment. Regardless of the filters I apply, it consistently returns over 900 million results (the entire database).

My Environment:

  • n8n Version: 2.1.5 (Self-hosted via Docker)

  • Constraint: Modern libraries like fetch or axios are unavailable. I am using the legacy this.helpers.request method.

What I have tried:

  1. HTTP Request Node: Configured a POST request with the JSON body. Filters were ignored.

  2. Code Node (JS): Used the following code for a simple “Top 100 products” test case to avoid any complexity.

Disguised Test Code:

JavaScript

const k = "YOUR_API_KEY"; // API Key Hidden
const payload = {
  "domainId": 1,
  "selection": {
    "pagination": { "page": 0, "perPage": 50 },
    "sort": [["current_SALES", "asc"]],
    "filters": {
      "rootCategory": 284507, 
      "current_SALES_gte": 1, 
      "current_SALES_lte": 100,
      "productType": [0],
      "csv_SALES": false
    }
  }
};

const options = {
  method: 'POST',
  uri: "https://api.keepa.com/query?key=" + k,
  body: payload,
  json: true
};

try {
  const response = await this.helpers.request(options);
  return [{ json: response }];
} catch (e) {
  return [{ json: { error: true, message: e.message } }];
}

Observation:

  • The API call returns Status 200.

  • tokensConsumed is approximately 11, indicating a valid /query call.

  • However, totalResults always shows 989,911,511.

It seems like the nested JSON object in the selection parameter isn’t being serialized in a way that the Keepa API recognizes when sent from n8n v2.1.5. Does anyone have experience with this specific serialization issue or a workaround for this legacy environment?

Thank you for your help!

Hi @BITEC_Guard,

Are you able to replicate a successful call to the Keepa api from Postman? I would start with that to confirm if it is an issue with n8n or the Keepa api itself

Hi,

I’ve managed to solve this issue through some internal testing and configuration adjustments.

It is now working as expected. Thank you!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.