IoT SQL function `get_dynamodb` fails unexpectedly

0

Execution of the get_dynamodb function of IoT SQL fails with a strange error message when calling it with the four parameters specified in the documentation https://docs.aws.amazon.com/iot/latest/developerguide/iot-sql-functions.html.

My rule definition equals

SELECT
    *,
    get_dynamodb("myTableName", "devEui", WirelessMetadata.LoRaWAN.DevEui, "myRoleArn") AS context
FROM 'myTopic'
WHERE
    message.WirelessMetadata.LoRaWAN.FPort = 10
    OR message.WirelessMetadata.LoRaWAN.FPort = 32

I have configured fine-grained logging for AWS IoT Core and see the following error message in CloudWatch

{
logLevel: ERROR
reason: ExternFunctionException
status: Failure
timestamp: 2021-12-29 07:12:10.436
details: Function 'GetDynamodb' failed to execute for rule 'XXX'. get_dynamodb takes either 4 or 6 arguments, but 4 given. Expected get_dynamodb(tableName, partitionKeyName, partitionKeyValue, roleArn) or get_dynamodb(tableName, partitionKeyName, partitionKeyValue, sortKeyName, sortKeyValue, roleArn).
eventType: RuleExecution
}

Is there something I'm missing or is the IoT Core SQL function documentation outdated?

gefragt vor 2 Jahren396 Aufrufe
1 Antwort
0
Akzeptierte Antwort

I solved this by fixing a typo in the query. Namely, the partitionKeyValue argument missed the message prefix. The error message was a bit misleading as it stated that I had called the function with four arguments even though one of these was undefined.

beantwortet vor 2 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen