aws / aws-parallelcluster

AWS ParallelCluster is an AWS supported Open Source cluster management tool to deploy and manage HPC clusters in the AWS cloud.
https://github.com/aws/aws-parallelcluster
Apache License 2.0
818 stars 309 forks source link

AWS ParallelCluster API is a serverless application with JavaScript client-side #4513

Open bacharzin opened 1 year ago

bacharzin commented 1 year ago

Failed to use the deployed API in my JavaScript applciation. Here is the full information about a test I did on AWS Cloudshell using javascript and python examples, both using the instruction from: https://docs.aws.amazon.com/parallelcluster/latest/ug/api-reference-v3.html

The issue:

In JavaScript, when I use the API_KEY, i got an error in the response about missing authentication header. In Python, I have the same issue. In JavaScript, when I use aws sts assume-role to switch the role, and don't provide API_KEY, i have different authentication error. In Python, when I do the same, the script works and gives the expected output

JavaScript error (With API_KEY)

Error: Forbidden status: 403, response: ... text: {"message":"Authorization header requires 'Credential' parameter. Authorization header requires 'Signature' parameter. Authorization header requires 'SignedHeaders' parameter. Authorization header requires existence of either a 'X-Amz-Date' or a 'Date' header. Authorization=NCyogaUawu8xMhSZK9wS055KIUz1BgMJ9EuhEpf0"}\n,

JavaScript error (With Role)

... text: '{"message":"Missing Authentication Token"}\n',

Test Requirement

For the test you need a key-pair and npm account (or you can use the one i created and still available)

Test files

The following files include the detailed instructions to repeat the tests and the output files from all commands (where relevant).

parallelClusterTest.txt jsOutput_with_role.txt pyOutput.txt pyOutput_with_key.txt pyOutput_with_key_and_role.txt jsOutput_with_key.txt jsOutput_with_key_and_role.txt

Therse are the python and js files:

describe_pcluster_client_with_key_js.txt describe_pcluster_client_with_key_py.txt test_pcluster_client_py.txt describe_pcluster_client_js.txt describe_pcluster_client_py.txt

bollig commented 1 year ago

Can you confirm that aws sts assume-role is switching your role properly? I see the API calls error, but where in the workflow are you seeing the first failure?

bacharzin commented 1 year ago

Yes it is. When I am calling describe_pcluster_client.py the script returns the expected output, see pyOutput.txt.

in describe_pcluster_client_with_key.js, there is this log command: console.log(process.env.AWS_SECRET_ACCESS_KEY)

when I switch the role, this prints the right key.

The error appears every time i use the API_KEY for authentication before calling describe cluster: describe_pcluster_client_with_key.js:12 describe_pcluster_client_with_key.py:25