When i try creating the Quicksight namespace from my local lambda function it is getting created, but when i try executing it in the AWS account the logs show it has created but actually not. Please suggest. Thanks!

Below is the code which am using for creating the namespace. The below code working perfectly with east-1 region for local testing but not in the server. But cloud watch log shows created in server also but actually not.

CreateNamespaceResponse response = await client.CreateNamespaceAsync(new CreateNamespaceRequest()
{
AwsAccountId = accountID,
Namespace = “TestNamespace”,
IdentityStore = “QUICKSIGHT”
});

Can you go into your cli and run the list-namespaces command and see if it’s there?

https://docs.aws.amazon.com/cli/latest/reference/quicksight/list-namespaces.html

Yes tried with CLI, it is not showing( only locally created one’s are appearing)

Hi ,

Can you post a screenshot of the response from the cli command ? . What does “locally” here mean ?

Regards,
Koushik

@Koushik_Muthanna When i run visual studio (.net code) from my local machine the same code is creating the namespace and able to see that in the namespace list through cli command ( list-namespaces). The same Lambda code deployed in aws and the log messages shows it is created but list is not showing with the namespace.
Below is the code for creating the namespace.

Below is the example response
image

Below is the log message that prints
image

Hi,

As I understand , you are creating a new namespace ( TestNamespace1 ) . The log message just states that the process has started.

When you run list-namespaces , are you able to see this new namespace which has been created ?
If not, to further deubg your lambda code, please check the cloudwatch logs for additional information.

example output using CLI

88665a256657:~ xxxx$ aws quicksight list-namespaces --aws-account-id 123456789091
{
    "Namespaces": [
        {
            "Name": "Customer1",
            "Arn": "arn:aws:quicksight:eu-central-1:123456789091:namespace/Customer1",
            "CapacityRegion": "eu-central-1",
            "CreationStatus": "CREATED",
            "IdentityStore": "QUICKSIGHT"
        },
        {
            "Name": "customer2",
            "Arn": "arn:aws:quicksight:eu-central-1:123456789091:namespace/customer2",
            "CapacityRegion": "eu-central-1",
            "CreationStatus": "CREATED",
            "IdentityStore": "QUICKSIGHT"
        },
        {
            "Name": "Customer-us-east-1",
            "Arn": "arn:aws:quicksight:eu-central-1:123456789091:namespace/Customer-us-east-1",
            "CapacityRegion": "eu-central-1",
            "CreationStatus": "CREATED",
            "IdentityStore": "QUICKSIGHT"
        },
        {
            "Name": "default",
            "Arn": "arn:aws:quicksight:eu-central-1:123456789091:namespace/default",
            "CapacityRegion": "eu-central-1",
            "CreationStatus": "CREATED",
            "IdentityStore": "QUICKSIGHT"
        }
    ],
    "Status": 200,
    "RequestId": "f23d72a9-ff65-444e-9b82-b80fc0e96d7c"
}

When you run list-namespaces , are you able to see this new namespace which has been created ?

Yes, when Create Namespace function runs from my local machine.
No, when the Lambda function runs from AWS.

Cloud watch logs says Namespace is created, but actually not.

Hi,

Following 2 possibilities :

  1. If your lambda code executed successfully and running the list-namespaces through CLI ( a sample example i have provided previously ) provides a list of all namespaces including the one from your lambda code. Then namespace has been created.

  2. If your lambda code executed successfully and the list-namespaces through CLI does show not it, then I would suggest that you log a ticket so that team can debug the issue.
    If you have access to the AWS console of the AWS account where you’re using QuickSight, please see these instructions 1 on how to raise a support case.
    If you do not have access, you’d need to ask whoever manages your AWS account for you to raise a support ticket.

1 Like

@n_vetri , Could you please suggest on this. Thanks!

Hello @Prasannat .

On your previous post you are sharing the following snapshot that shows the status of the namespace that your lambda function creates:

image

This is output via the default logging as instructed on this line:

If you see the status is CREATING which is just one of the valid Statuses for this API call more info here

The valid statuses are:

CREATED | CREATING | DELETING | RETRYABLE_FAILURE | NON_RETRYABLE_FAILURE

The reason for having all these states is because the CreateNamespace operation is an asyncronous operation so this means that you will need to perform polling of the create operation to perform error handling appropriately (as it seems that your namespace is not created and its ending up either on RETRYABLE_FAILURE or NON_RETRYABLE_FAILURE).

In order to do this you will need to combine CreateNamespace and DescribeNamespace API calls.

Pseudo-code would look like this:

final_states = CREATED | NON_RETRYABLE_FAILURE
response = CreateNamespace(NamespaceName)
while status not in final_states
do
     response =  DescribeNamespace(NamespaceName)
     status = response.Namespace.CreationStatus
     sleep 10 // recomemnded to use exponential backoff here [1] instead of just a pause
done

if status == CREATED 
then
   log("Namespace NamespaceName was successfully created")
else
   log("Namespace NamespaceName failed creation")
      log("Error details are: "+ response.Namespace.NamespaceError.Message)
fi

This will output in the logs the reason why the namespace is not being created.

Hope it helps, please mark this solution as solved if that’s the case also to help other members of the community., otherwise let us know.

Happy dashboarding!

Links:
[1] Error retries and exponential backoff in AWS - AWS General Reference

Hi, @Prasannat

We hope Enrique’s solution helped you understand what is occurring. Let us know if this is resolved. And if it is, please help the community by marking his answer as a “Solution.