AWS DynamoDB Expression Attribute Values are not resolved from input consistently

I have a DynamoDB table with Partition Key “channel_name” (String) and Sort Key “date_int” (Number).

I am using the DynamoDB node to construct a query using Key Condition Expression with Expression Attribute Values. I can construct a query that returns a test record, but only if the Sort Key is defined as a Fixed Value in the DynDB node. Attempting to construct the same query using an Expression value that is read from input $json results in an AWS error.

The following are screenshots of two queries that, on the face of it look identical. The only difference is in the second (failed) query, the Sort Key value is set as an Expression rather than Fixed value.

Successful request (Part Key read from input $json. Sort key defined as Fixed Value):

Failed request (Part key and Sort key read from input $json):

Note that the Sort Key value looks identical in the n8n UI in both queries.

Any clues on this would be welcomed. Thank you.

Information on your n8n setup

  • n8n version: 1.16.0:
  • Database: Postgres
  • n8n EXECUTIONS_PROCESS setting: Redis with workers. Webhook on dedicated worker
  • Running n8n via: Docker
  • Operating system: Ubuntu Linux

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

hello @surbitron

Don’t know how the DB node treats the arguments, but I suppose there might be a type mismatch.

Try to change the {{ $json.dateInt}} to {{ $json.dateInt.toString()}}

2 Likes

Ok, that worked. Thank you @barn4k for your help.

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