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?

질문됨 2년 전396회 조회
1개 답변
0
수락된 답변

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.

답변함 2년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠