Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 18:23

    aws-sdk-js-automation on v2.1142.0

    (compare)

  • 18:23

    aws-sdk-js-automation on master

    Updates SDK to v2.1142.0 (compare)

  • 12:23
    irenakovalyova commented #3534
  • 09:31
    Nizari commented #3673
  • 08:58
    Arun-KumarH edited #4109
  • 08:56
    Arun-KumarH edited #4109
  • 08:55
    Arun-KumarH edited #4109
  • 08:55
    Arun-KumarH labeled #4109
  • 08:55
    Arun-KumarH labeled #4109
  • 08:55
    Arun-KumarH opened #4109
  • 06:31
    doverradio commented #4079
  • 06:31
    doverradio commented #4079
  • 00:13
    github-actions[bot] closed #4096
  • 00:13
    github-actions[bot] labeled #4096
  • 00:13
    github-actions[bot] unlabeled #4096
  • May 23 18:24

    aws-sdk-js-automation on master

    Updates SDK to v2.1141.0 (compare)

  • May 23 18:24

    aws-sdk-js-automation on v2.1141.0

    (compare)

  • May 23 16:04
    airjp73 commented #1769
  • May 23 13:34
    ajredniwja unlabeled #4079
  • May 23 13:34
    ajredniwja assigned #4079
Jerng
@jerng
Screenshot from 2020-05-12 16-34-36 (2).png Hello, is there a standard way to troubleshoot "builds from the SDK builder"? I have not been able to run the downloaded .js file. I actually want to run this in Node on Lambda, but I also tested it in the browser, and the screencap is from the browser error.
This message was deleted
Darwayne Jay Alfaro
@alfarodarwaynejay
Hello everyone, is it possible to use sdk to create and deploy eks cluster? Does anyone has some documentations, besides the aws docs, and tutorials? thanks.
Darko
@darko-dev
Hello everyone! Is there a chance anyone can help me with this? https://stackoverflow.com/questions/61878155/retrieve-aws-app-config-configuration-from-reactjs-app
Níko Escobar
@NikoEscobar

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? =(

I was trying to avoid indentation, and async await help me really good to prevent it, is there any way of getting the describeTrustedAdvisorChecks data in such a way? =)
kes333
@kes333

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
});
}
});
};

BertrandMarechal
@BertrandMarechal
hi - if you are using ApiGateway, you may want to check where the data is coming from. if your id is a path parameter, you'll find it in 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
kes333
@kes333

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)"
]
}

BertrandMarechal
@BertrandMarechal
which line is line 17 ?
kes333
@kes333
const id = event.pathParameters.id;
BertrandMarechal
@BertrandMarechal
and this is invoking frm apiGateway ?
weird
did you declare the pathParameter in the Api geway configuration ?
kes333
@kes333
Now it is not even working from the lambda function
yes I did
BertrandMarechal
@BertrandMarechal
did you deploy the api gateway after that ?
kes333
@kes333
yes, I deployed the API
I just redeployed with path parameter 'id' and mapping 'method.request.path.id' , mapping templates etc same error
BertrandMarechal
@BertrandMarechal
you redeployed the api and/or the lambda function ?
kes333
@kes333
I redeployed the Lambda function and and looks like function is not able to parse the JSON payload {
"id": "c4b3c635b-853c-4a6d-bfbe-77f3235c354c",
"cover": "AAAA",
"productType": "GGGG",
"state": "TAS",
"value": "6756"
}errorMessage": "Unexpected token A in JSON at position 0", and the logs returning not a JSON response from this function :
BertrandMarechal
@BertrandMarechal
what does the function look like now ?
you can paste it as this for a better formatting ```<your code here>```
kes333
@kes333
I reverted to my original function I posted initially, works from Lambda function, while in API gateway, it gives 200 but error as "supplied attribute empty.I have all the setting in API gateway like mapping template and path parameters. Want to understand why when calling from API gateway, the 'id' is not assigned a value. As mentioned above, request.pathParameters.id does not work in the Lambda function as well. If I assign a value to id from my Lambda hardcoded, it starts working. But thats not what I want in an update function, I want the Id to be consistent in an update and should be taken from the input parameter. However, when I insert input parameter in template , the API throws JSOn validation error ("id": $input.params('id'), , my current template just has the json bit as follows: {
"cover": $input.json('$.cover'),
"productType": $input.json('$.productType'),
"state": $input.json('$.state'),
"value": $input.json('$.value')
}
kes333
@kes333
"Could not parse request body into json: Unrecognized token \'b58892cd\': was expecting (\'true\', \'false\' or \'null\')\n at [Source
BertrandMarechal
@BertrandMarechal
how are you invoking APIGateway ?
and why aren't you getting all the other properties from the body ?
kes333
@kes333
Well I am inserting path parameter in the path and the body, a json object..looking into it, probably the GUUID which is the issue, shall update
BertrandMarechal
@BertrandMarechal
the issue is in a mapping somewhere - wrong type
kes333
@kes333
Working now , had to do with the UUID. I created a random number for the Id ,probably that did the trick. it probably was not able to parse the UUID. function between(min, max) {
return Math.floor(
Math.random() (max - min + 1) + min ).toString();
}
original UUID function was :function uuidv4() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
var r = Math.random()
16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
return v.toString(16);
});
}
BertrandMarechal
@BertrandMarechal
glad you figured it out ! :thumbsup:
Michał Dymel
@mdymel_gitlab
Hi, I have a browser app built with angular, which is used to manage resources using CloudFront. I want to be able to disable and delete the CF distributions. However when I use getDistribution from the js SDK, I am not getting the ETAG value - probably due to CORS restrictions. How can I work around it?
rajesh
@getmetorajesh_twitter
are there any default retryDelayOptions set for s3 uploads in the sdk
BertrandMarechal
@BertrandMarechal
it seems like you need to set it on the s3 initialization itself
rajesh
@getmetorajesh_twitter
thanks @BertrandMarechal
Jaafar Shhade
@jfrshd
Hello,
const paramsCredentials: CognitoIdentityCredentials.CognitoIdentityOptions = {
IdentityPoolId: this.POOL_DATA.IdentityPoolID,
Logins: {}
};
      paramsCredentials.Logins[this.POOL_DATA.YOUR_USER_POOL_ID_IDP] = session.getIdToken().getJwtToken();

      AWS.config.region = 'eu-east-2';
      AWS.config.credentials = new AWS.CognitoIdentityCredentials(paramsCredentials, {region: 'eu-east-2'});
      console.log(AWS.config.credentials);
      new AWS.CognitoIdentityCredentials(paramsCredentials, {
        region: 'eu-east-2',
      }).get((err) => {
        console.log('err', err);
      });
      // console.log('AWS.config.credentials', AWS.config.credentials);
      // config.credentials.get((err: AWSError) => {
      // if (!err) {
      // const id = config.credentials.identityId;
      // console.log('Cognito Identity ID ' + id);

      const docClient = new AWS.DynamoDB.DocumentClient({region: 'eu-east-2'});

      const params = {
        TableName: this.ddbTable,
        Item: {userid: 'haha', status: 'worked'}
      };

      docClient.put(params, (error, data) => {
        if (error) {
          console.log('error put', error);
        } else {
          console.log(data);
        }
      });

i am facing an error :

error put CredentialsError: Missing credentials in config

please help i found nothing
BertrandMarechal
@BertrandMarechal
Hey
where do you run this code ? locally ?
Jaafar Shhade
@jfrshd
yes
i am using angular
BertrandMarechal
@BertrandMarechal
so this is part of an angular service ?
Jaafar Shhade
@jfrshd
yes
BertrandMarechal
@BertrandMarechal
ok
so this error is usually linked to the fact that AWS cannot find the aws credentials (as api keys) from your environment variables
Jaafar Shhade
@jfrshd
should i be using secret and access keys?