Agora cloud recording with Google cloud storage - google-cloud-platform

I want to record my voice call with agora cloud recording. I'm using a Postman collection provided by Agora, and I don't change anything except StorageConfig. I'm successful in getting resourceID and sid, but when I stop recording, I receive the error "Failed to find worker." Based on an agora document, they said for Google Clound the region parameter has no effect, whether it is set or not, so I'm setting it to 0. There's a list of solutions I've tried but have had no success with:
Change region
Both users have different UIDs, and the recording UID is different from them.
Access key and secret key is correct
I don't know what I did wrong. Please help me. Thanks all.
{
"resourceId": "nUwUbQf9Zg6tsgtLslGnDg0lk8RYaUE09pqOuSIgwfwi6-n9kITolzw3vvIFHMfm2VZsOrLd9fk9kMzos8Y_D-2Z2fFtUu_1BD2_pKJEZ-jTgXPe--K6Ua7TpSNY0pLd4zzyZV6iXCndqZvHmfsZloox0y-UZgs-r2_zBR2Gor05YCP0HuusWF8Kv1StAYabr1HJykw7RorDYnUIzzry6p6LRfvlq2zJVyVxvzVRVmoeMPYX-cVKyhNDuI2ct9a9aPdi8jCwDUzRbYimVVAnJBRYppTH012Xt6DnnMBkskJsbK0-CK3IaipQA9Gu2RmIJxSowuZbHspwA2lpwpzre-aNG6NlXk95hZgthOfNUVE",
"sid": "edd35b65ec496e43aa502cad99bbdb27",
"code": 404,
"serverResponse": {
"command": "StopCloudRecorder",
"payload": {
"message": "Failed to find worker."
},
"subscribeModeBitmask": 1,
"vid": "1020399"
}
}

Related

GCP Snapshot create API failing through C++ code, but not through postman

I've been trying to make API calls to create snapshot of GCP disk through my code but it keeps giving me this error:
Failed to check snapshot status before creating GCPDisk swift-snapshot-gkeos-dkdwl-dynamic-pvc-1b13097f-7-1630579922. HTTP Error: GET request to the remote host failed [HTTP-Code: 404]: {
"error": {
"code": 404,
"message": "The resource 'projects/rw-migration-dev/global/snapshots/swift-snapshot-gkeos-dkdwl-dynamic-pvc-1b13097f-7-1630579922' was not found",
"errors": [
{
"message": "The resource 'projects/rw-migration-dev/global/snapshots/swift-snapshot-gkeos-dkdwl-dynamic-pvc-1b13097f-7-1630579922' was not found",
"domain": "global",
"reason": "notFound"
}
]
}
}
My program worked fine for a considerable amount of time, but now sometimes it gives errors.
I tried passing the same query through postman and it works fine. Some times it works fine through .
The main problem is with the snapshot creating API,
https://compute.googleapis.com/compute/v1/projects/{projectName}/zones/{diskLocation}/disks/{diskName}/createSnapshot
This URL works fine on postman, after creation you can see the snapshot when you list them, but through code once this API is called it returns an OK 200, but no snapshot is created
Can someone tell me why this is happening?
I think you are trying to use this operation:
https://cloud.google.com/compute/docs/reference/rest/v1/disks/createSnapshot
Which is a long running operation, a 200 response indicates that the snapshot operation started, but it does not indicate that it has finished.
The documentation points to:
https://cloud.google.com/compute/docs/api/how-tos/api-requests-responses#handling_api_responses
You may need to poll the operation until it completes before trying to use the snapshot.

Debugging "read time out" for AWS lambda function in Alexa Skill

I am using an AWS lambda function to serve my NodeJS codebase for an Alexa Skill.
The skill makes external API calls to a custom API as well as the Amazon GameOn API, it also uses URL's which serve audio files and images from an S3 Bucket.
The issue I am having is intermittent, and is affecting about 20% of users. At random points of the skill, the user request will produce an invalid response from the skill, with the following error:
{
"Request": {
"type": "System.ExceptionEncountered",
"requestId": "amzn1.echo-api.request.ab35c3f1-b8e6-4478-945c-16f644359556",
"timestamp": "2020-05-16T19:54:24Z",
"locale": "en-US",
"error": {
"type": "INVALID_RESPONSE",
"message": "Read timed out for requestId amzn1.echo-api.request.323b1fbb-b4e8-4cdf-8f31-30c9b67e4a5d"
},
"cause": {
"requestId": "amzn1.echo-api.request.323b1fbb-b4e8-4cdf-8f31-30c9b67e4a5d"
}
},
I have looked up this issue, I believe it's something wrong with the lambda function configuration but can't figure out where!
I've tried increasing the Memory the function uses (now 256MB).
It should be noted that the function timeout is 8000ms, since this is the max time you are allowed for an Alexa response.
What causes this Read timeout issue, and what measures can I take to debug and resolve it?
Take a look at AWS XRay. By using this with your Lambda you should be able to identify the source of these timeouts.
This link should help you understand how to apply it.
We found that this was occurring when the skill was trying to access a resource which was stored on our Azure website.
The CPU and Memory allocation for the azure site was too low, and it would fail when facing a large amount of requests.
To fix, we improved the plan the app service was running on.

Cognito User Migration Trigger - Exception during user migration - Exception Location

We're using a lambda function to respond to the 'User Migration' trigger in AWS Cognito. When something like a syntax error occurs, you can see it in cloud watch logs. However, "Exception during user migration" errors seen on the login page are no where to be found in the cloud watch logs.
Where are we supposed to look for these? I can't find any anything in the documentation and assumed it would have gone to cloud watch.
I can't test it in the lambda interface because one of the parameters being passed into the lambda function will have a function nested within the object and I can't create a test JSON setup that has that. There's also no test trigger for user migration that is pre-built.
Any ideas as to why I can't see this in cloud watch or where the exceptions would be shown would be greatly appreciated.
Unfortunately Cogntio doesn't expose any logs (or metrics, for that matter!).
The closest you can get is to view the lambda's logs in CloudWatch. If you log your response, and watch your lambda's error metric then you should mostly be able to debug issues internal to the lambda.
This does leave a few edge cases:
You won't see anything if the lambda can't be invoked (this would only happen under heavy concurrent loads either on that single lambda, or on all lambdas across your account)
If you return a bad response the lambda will succeed but the trigger action will fail and Cognito will give you a fairly generic message. At this point you're at the mercy of AWS' documentation to work out what's wrong (which can be a bit hit and miss- although StackOverflow always helps!).
You can find an example payload for the lambda in the trigger documentation:
{
"userName": "THE USERNAME",
"request": {
"password": "THE PASSWORD"
},
"response": {
// it is your responsibility to fill this bit in and return the completed object back:
"userAttributes": {
"string": "string",
...
},
"finalUserStatus": "string",
"messageAction": "string",
"desiredDeliveryMediums": [ "string", ... ],
"forceAliasCreation": boolean
}
}
n.b. As an aside, which you might know, but Lambda payloads always have to be in JSON, which does not store functions. So you should always be able to derive a test payload to use in the console.

How to access sessionAttributes values from amazon lex response in Amazon Connect?

I have set the value of session attribute in my lambda function response, which I am getting in amazon lex after invoking it from Lex. But, When I tried to access this value in Amazon connect using -
$.Lex.SessionAttributes.dateFlag
I am not able to access it.
I have already tried using Type as external and Lex Attributes.
I am putting the condition in amazon connect based on the values received from Above.
In logs I found that the condition where I am comparing this value comes to false.
Can anyone suggest some idea on how to get the custom value/sessionAttribute values from Lex/Lambda in Amazon Connect.
Below is my response JSON from Lex. I am trying to access the dateFlag.
{
"dialogState": "Fulfilled",
"intentName": "suitabletime",
"message": "Thanks for the confirmation",
"messageFormat": "PlainText",
"responseCard": null,
"sessionAttributes": {
"dateFlag": "1",
"previousIntent": "suitabletime"
},
"slotToElicit": null,
"slots": {
"date": "2018-09-14",
"time": "13:00"
}
}
Finally I found the solution. This is simpler than what I was writing. We can directly access the session attribute in our connect by taking the attribute type as Lex attribute and Attribute as Attribute Key/Name.
Below is the screenshot for the same.

AWS API Gateway : Execution failed due to configuration error: No match for output mapping and no default output mapping configured

In AWS API Gateway, I have a GET method that invokes a lambda function.
When I test the method in the API Gateway dashboard, the lambda function executes successfully but API Gateway is not mapping the context.success() call to a 200 result despite having default mapping set to yes.
Instead I get this error:
Execution failed due to configuration error: No match for output mapping and no default output mapping configured
This is my Integration Response setup:
And this is my method response setup:
Basically I would expect the API Gateway to recognize the successful lambda execution and then map it by default to a 200 response but
that doesn't happen.
Does anyone know why this isn't working?
I have same issue while uploading api using serverless framework. You can simply follow bellow steps which resolve my issue.
1- Navigate to aws api gateway
2- find your api and click on method(Post, Get, Any, etc)
3- click on method response
4- Add method with 200 response.
5- Save it & test
I had the similar issue, got it resolved by adding the method response 200
This is a 'check-the-basics' type of answer. In my scenario, CORS and the bug mentioned above were not at issue. However, the error message given in the title is exactly what I saw and what led me to this thread.
Instead, (an an API Gateway newb) I had failed to redeploy the deployment. Once I did that, everything worked.
As a bonus, for Terraform 0.12 users, the magic you need and should use is a triggers parameter for your aws_api_gateway_deployment resource. This will automatically redeploy for you when other related APIGW resources change. See the TF documentation for details.
There was an issue when saving the default integration response mapping which has been resolved. The bug caused requests to API methods that were saved incorrectly to return a 500 error, the CloudWatch logs should contain:
Execution failed due to configuration error:
No match for output mapping and no default output mapping configured.
Since the 'ENABLE CORS' saves the default integration response, this issue also appeared in your scenario.
For more information, please refer to the AWS forums entry: https://forums.aws.amazon.com/thread.jspa?threadID=221197&tstart=0
Best,
Jurgen
What worked for me:
1. In Api Gateway Console created OPTIONS method manually
2. In the Method Response section under created OPTIONS method added 200 OK
3. Selected Option method and enabled CORS from menu
I found the problem:
Amazon had added a new button in the API-Gateway resource configuration
titled 'Enable CORS'. I had earlier clicked this however once enabled
there doesn't seem to be a way to disable it
Enabling CORS using this button (Instead of doing it manually which is what I ended up doing) seems to cause an internal server error even on a
successful lambda execution.
SOLUTION: I deleted the resource and created it again without clicking
on 'Enable CORS' this time and everything worked fine.
This seems to be a BUG with that feature but perhaps I just don't
understand it well enough. Comment if you have any further information.
Thanks.
Check the box which says "Use Lambda Proxy integration".
This works fine for me. For reference, my lambda function looks like this...
def lambda_handler(event, context:
# Get params
param1 = event['queryStringParameters']['param1']
param2 = event['queryStringParameters']['param2']
# Do some stuff with params to get body
body = some_fn(param1, param2)
# Return response object
response_object = {}
response_object['statusCode'] = 200
response_object['headers'] = {}
response_object['headers']['Content-Type']='application/json'
response_object['body'] = json.dumps(body)
return response_object
I just drop this here because I faced the same issue today and in my case was that we are appending at the end of the endpoint a /. So for example, if this is the definition:
{
"openapi": "3.0.1",
"info": {
"title": "some api",
"version": "2021-04-23T23:59:37Z"
},
"servers": [
{
"url": "https://api-gw.domain.com"
}
],
"paths": {
"/api/{version}/intelligence/topic": {
"get": {
"parameters": [
{
"name": "username",
"in": "query",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "version",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "x-api-key",
"in": "header",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "X-AWS-Cognito-Group-ID",
"in": "header",
"schema": {
"type": "string"
}
}
],
...
Remove any / at the end of the endpoint: /api/{version}/intelligence/topic. Also do the same in uri on apigateway-integration section of the swagger + api gw extensions json.
Make sure your ARN for the role is indeed a role (and not, e.g., the policy).