mohankumarpaluru / oracle-freetier-instance-creation

A script to create free instance
MIT License
176 stars 34 forks source link

Error: 401, 'Failed to verify the HTTP(S) Signature' #31

Closed willjvv closed 3 months ago

willjvv commented 4 months ago

Describe the bug File "/home/ubuntu/oracle-freetier-instance-creation/main.py", line 310, in execute_oci_command response = getattr(client, method)(*args, kwargs) File "/home/ubuntu/oracle-freetier-instance-creation/.venv/lib/python3.10/site-packages/oci/identity/identity_client.py", line 8285, in get_user return retry_strategy.make_retrying_call( File "/home/ubuntu/oracle-freetier-instance-creation/.venv/lib/python3.10/site-packages/oci/retry/retry.py", line 308, in make_retrying_call response = func_ref(*func_args, *func_kwargs) File "/home/ubuntu/oracle-freetier-instance-creation/.venv/lib/python3.10/site-packages/oci/base_client.py", line 535, in call_api response = self.request(request, allow_control_chars, operation_name, api_reference_link) File "/home/ubuntu/oracle-freetier-instance-creation/.venv/lib/python3.10/site-packages/circuitbreaker.py", line 159, in wrapper return call(function, args, kwargs) File "/home/ubuntu/oracle-freetier-instance-creation/.venv/lib/python3.10/site-packages/circuitbreaker.py", line 170, in call return func(*args, **kwargs) File "/home/ubuntu/oracle-freetier-instance-creation/.venv/lib/python3.10/site-packages/oci/base_client.py", line 726, in request self.raise_service_error(request, response, service_code, message, operation_name, api_reference_link, target_service, request_endpoint, client_version, timestamp, deserialized_data) File "/home/ubuntu/oracle-freetier-instance-creation/.venv/lib/python3.10/site-packages/oci/base_client.py", line 891, in raise_service_error raise exceptions.ServiceError( oci.exceptions.ServiceError: {'target_service': 'identity', 'status': 401, 'code': 'NotAuthenticated', 'opc-request-id': '394A6BBD79A24FD7BDF0F791110943B9/F96194D1D64B5396A5BDC553A6491C3E/33F6DED5A9BC2698251D8F393C1F31DF', 'message': 'Failed to verify the HTTP(S) Signature', 'operation_name': 'get_user', 'timestamp': '2024-07-30T03:15:30.628592+00:00', 'client_version': 'Oracle-PythonSDK/2.129.4', 'request_endpoint': 'GET https://identity.us-ashburn-1.oci.oraclecloud.com/20160918/users/ocid1.user.oc1..aaaaaaaart3iegzqs6dyasojlff4gbpt4ly6qcjml2hgn33pemvx35fmbw6a', 'logging_tips': 'To get more info on the failing request, refer to https://docs.oracle.com/en-us/iaas/tools/python/latest/logging.html for ways to log the request/response details.', 'troubleshooting_tips': "See https://docs.oracle.com/iaas/Content/API/References/apierrors.htm#apierrors_401__401_notauthenticated for more information about resolving this error. Also see https://docs.oracle.com/iaas/api/#/en/identity/20160918/User/GetUser for details on this operation's requirements. If you are unable to resolve this identity issue, please contact Oracle support and provide them this full error message."}

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/ubuntu/oracle-freetier-instance-creation/main.py", line 464, in launch_instance() File "/home/ubuntu/oracle-freetier-instance-creation/main.py", line 364, in launch_instance user_info = execute_oci_command(iam_client, "get_user", OCI_USER_ID) File "/home/ubuntu/oracle-freetier-instance-creation/main.py", line 317, in execute_oci_command handle_errors(args, data, logging_step5) File "/home/ubuntu/oracle-freetier-instance-creation/main.py", line 290, in handle_errors raise Exception("Error: %s" % data) Exception: Error: {'status': 401, 'code': 'NotAuthenticated', 'message': 'Failed to verify the HTTP(S) Signature'}

Expected behavior I get the above output when running main.py before the process closes.

Instance Type:

Environment:

Update Was able to run the program with no problems from my own computer (as opposed to a free micro instance). Unsure of the cause but it works fine as long as my computer stays on.

mohankumarpaluru commented 4 months ago

check if your key path is proper in config file

willjvv commented 4 months ago

Seemingly not, here's my path to the key: /home/ubuntu/oracle-freetier-instance-creation/oci_api_private_key.pem And here's how I have it in the oci_config file: image

borislassort commented 4 months ago

@willjvv Can you try to change the key file permissions: chmod go-rwx /home/ubuntu/oracle-freetier-instance-creation/oci_api_private_key.pem

willjvv commented 3 months ago

@willjvv Can you try to change the key file permissions: chmod go-rwx /home/ubuntu/oracle-freetier-instance-creation/oci_api_private_key.pem

Same problem: setup_init.sh: 21: source: not found setup_init.sh: 25: pip: not found setup_init.sh: 26: pip: not found setup_init.sh: 27: pip: not found