Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 10:14
    danopia synchronize #3997
  • 10:00
    arahatashun review_requested #4014
  • 10:00
    arahatashun ready_for_review #4014
  • 09:56
    arahatashun edited #4014
  • 09:55
    arahatashun edited #4014
  • 09:55
    arahatashun synchronize #4014
  • 08:38
    arahatashun opened #4014
  • 07:34

    trivikr on master

    Bump JMESPath to 0.16.0 (#4012) (compare)

  • 07:34
    trivikr closed #4012
  • 06:05
    hellopeera edited #4013
  • 06:05
    hellopeera edited #4013
  • 06:05
    hellopeera edited #4013
  • 06:04
    hellopeera labeled #4013
  • 06:04
    hellopeera labeled #4013
  • 06:04
    hellopeera opened #4013
  • 05:11
    indiub commented #3987
  • 00:38
    mobsense commented #3520
  • 00:07
    github-actions[bot] labeled #3520
  • 00:07
    github-actions[bot] commented #3520
  • Jan 19 22:29
    AllanZhengYP review_requested #4012
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?
BertrandMarechal
@BertrandMarechal
yes and no : Yes, that's what AWS SDK is expecting, no in an angular service if you are about to deploy it somewhere
it it is just a local app you are not gonna share, then you should be fine if you are careful (and do not share the credentials on a public github repo for instance)
Jaafar Shhade
@jfrshd
i mean i am trying to access the dynamo db using cognito user pool with identity pool
why should i need accesskey
they didn't mention that in the tutorial
BertrandMarechal
@BertrandMarechal
because they might be expecting you to run this code in Lambda or somewhere else where your credentials are set up
Jaafar Shhade
@jfrshd
Owwwwwwww
are you sure?