-
-
Notifications
You must be signed in to change notification settings - Fork 23
Open
Labels
Description
Describe the bug
Using local-data-api 0.6.7 with PostgreSQL I get an error when trying to pass an array as parameters in AWS.RDSDataService function executeStatement using JavaScript.
Postgres supposts Arrays as data type and RDSDataService does as well. But using arrays with local-data-api seems to not be supported as I get the following error in the docker logs:
2021-04-08 11:59:22.921 [eventLoopGroupProxy-4-2] ERROR Application - Unhandled: POST - /Execute kotlinx.serialization.json.internal.JsonDecodingException: Unexpected JSON token at offset 1146: Encountered an unknown key 'arrayValue'
To Reproduce
Steps to reproduce the behavior:
- Have setup using ProstgreSQL
- Create a simple table with a column called
colof typeTEXT[]
CREATE TABLE test ( col TEXT[] ) - have simple node script trying to insert data
const AWS = require('aws-sdk'); const client = new AWS.RDSDataService({ region: 'us-east-1', endpoint: 'http://127.0.0.1:8080', }); (async function() { try { await client.executeStatement({ resourceArn: 'arn:aws:rds:us-east-1:123456789012:cluster:dummy', secretArn: 'arn:aws:secretsmanager:us-east-1:123456789012:secret:dummy', database: 'test', sql: 'INSERT INTO test (col) VALUES (:data)', parameters: [{ name: 'data', value: { arrayValue: { stringValues: ['a', 'b'] }, }, }] }).promise(); } catch (e) { console.log(e); } })();
Expected behavior
a new entry in table test is created with the array ['a', 'b'] as value for column col.
Additional context
AWS documentation: https://docs.aws.amazon.com/rdsdataservice/latest/APIReference/API_ExecuteStatement.html