aws-sdk-js-automation on master
Updates SDK to v2.1143.0 (compare)
aws-sdk-js-automation on v2.1143.0
aws-sdk-js-automation on v2.1142.0
You may need an appropriate loader to handle this file type.
which complains about async/await. I see that sdk has both cjs and precompiled es exports, but somehow react-create-app picks csj version SyntaxError: Unexpected token (13:20)
@ ./~/@aws-sdk/credential-provider-cognito-identity/dist/cjs/index.js 4:21-53
Hey guys, I just released a small npm library that allows you to transform a CIDR and a list of denied sub-CIDRs into a list of allowed CIDRs:
https://github.com/Obirah/cidr-deny-allow-transformer
https://www.npmjs.com/package/cidr-deny-allow-transformer
Might come in handy for anyone who is dealing with SecurityGroups and their traffic configuration. My personal use-case is denying a set of sub-CIDRs that contain internet gateways while the rest of the larger "main" CIDR needs to be allowed. I'm using this in combination with CDK but I'm sure it might also be useful for some SDK users.
I am using node 6 and in the loop I am sending the files to s3 using aws-sdk and I get this error : buffer.js:25
const ui8 = new Uint8Array(size);
^
RangeError: Invalid array buffer length
at new ArrayBuffer (native)
at new Uint8Array (native)
at createBuffer (buffer.js:25:17)
at allocate (buffer.js:158:12)
at new Buffer (buffer.js:56:12)
at allocNewPool (fs.js:1602:10)
at ReadStream._read (fs.js:1701:5)
at ReadStream.Readable.read (_stream_readable.js:336:10)
at ManagedUpload.fillStream (/opt/ocu/node/node_modules/aws-sdk/lib/s3/managed_upload.js:422:25)
at ReadStream.<anonymous> (/opt/ocu/node/node_modules/aws-sdk/lib/s3/managed_upload.js:188:4425)
Hi guys, how you guys are doing? I hope everything is fine =)
I'm starting to work with aws-sdk-js, but I think I have some limitation in my knowledge of typescript,
I was trying to get the response data from the support.describeTrustedAdvisorChecks in such a way
try{
const response = await support.describeTrustedAdvisorChecks({language: 'en'})
}
and it wasn't working, so I decided to take a look on the typescript implementation
describeTrustedAdvisorChecks(callback?: (err: AWSError, data: Support.Types.DescribeTrustedAdvisorChecksResponse) => void): Request<Support.Types.DescribeTrustedAdvisorChecksResponse, AWSError>;
I'm really not sure but I think that I won't be able to get the data out of the describeTrustedAdvisorChecks method, unless I pass a callback and work with that data inside of it, is that right?
So using async await won't help me in that case right? =(
Hi Guys, understand this question may have been answered - looking for some idea. I have a lambda update function which just updates a row in a table. I am keeping the primary key -id as event.id and using the PUT method . When I test the function through Lambda, it works fine and updates the DynamoDB table. When I test from AWS API gateway, it gives error of attribute not initialised " "errorType": "ValidationException",
"errorMessage": "Supplied AttributeValue is empty, must contain exactly one of the supported datatypes". I am passing the id as path variable. and the logs look like the function is taking the path and the body attributes. as below Mon Jun 01 07:31:41 UTC 2020 : Method request path: {id=4aaf78ea-4d7a-49d5-b2bb-0c7ad1137495}
Mon Jun 01 07:31:41 UTC 2020 : Method request query string: {}
Mon Jun 01 07:31:41 UTC 2020 : Method request headers: {}
Mon Jun 01 07:31:41 UTC 2020 : Method request body before transformations: {
"cover":"XXXX",
"productType":"GGGG",
"state":"TAS",
"value":"4000"
} My Lambda function is as follows: const AWS = require("aws-sdk");
const dynamodb = new AWS.DynamoDB({
region: "ap-southeast-2",
apiVersion: "2012-08-10"
});
exports.handler = (event, context, callback) => {
const params = {
Item: {
id: {
S: event.id
},
cover: {
S: event.cover
},
productType: {
S: event.productType
},
state: {
S: event.state
},
value: {
S: event.value
}
},
TableName: "testtable"
};
dynamodb.putItem(params, (err, data) => {
if (err) {
console.log(err);
callback(err);
} else {
callback(null, {
id: params.Item.id.S,
cover: params.Item.cover.S,
productType: params.Item.productType.S,
state: params.Item.state.S,
value: params.Item.value.S
});
}
});
};
event.pathParameters.id
. then what you are trying to provide as state, value, cover... are probably stored in the body of your request, event.body
. Be aware that it is a stringified value so you will need JSON.parse(event.body).productType
to get the productType for instance
Thanks, I changed the code of the handler function as below but I am still getting error as id is undefined.
exports.handler = (event, context, callback) => {
const id = event.pathParameters.id;
const reqBody = JSON.parse(event.body);
const { cover,productType,state,value} = reqBody;
const params = {
Key: {
id: id
},
TableName: "baserate",
ConditionExpression: 'attribute_exists(id)',
UpdateExpression: 'SET cover = :cover, productType = :productType,state = :state,value = :value',
ExpressionAttributeValues: {
':cover': cover,
':productType': productType,
':state': state,
':value': value
},
ReturnValues: 'ALL_NEW'
};{
"errorType": "TypeError",
"errorMessage": "Cannot read property 'id' of undefined",
"trace": [
"TypeError: Cannot read property 'id' of undefined",
" at Runtime.exports.handler (/var/task/index.js:17:35)",
" at Runtime.handleOnce (/var/runtime/Runtime.js:66:25)"
]
}
```<your code here>```