You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When trying to use the Sample provided for pub/sub with IAM authorization, I receive this error:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/AWSIoTPythonSDK/core/protocol/paho/client.py", line 615, in tls_set
f = open(certfile, "r")
^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: ''
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/prashidi/workspace/aws/iot/iot-test-publish/publish.py", line 19, in <module>
myAWSIoTMQTTClient.configureCredentials("./certificates/AmazonRootCA1.pem")
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/AWSIoTPythonSDK/MQTTLib.py", line 246, in configureCredentials
self._mqtt_core.configure_cert_credentials(cert_credentials_provider, cipher_provider)
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/AWSIoTPythonSDK/core/protocol/mqtt_core.py", line 132, in configure_cert_credentials
self._internal_async_client.set_cert_credentials_provider(cert_credentials_provider, ciphers_provider)
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/AWSIoTPythonSDK/core/protocol/internal/clients.py", line 86, in set_cert_credentials_provider
self._paho_client.tls_set(ca_certs=ca_path,certfile=cert_path, keyfile=key_path,
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/AWSIoTPythonSDK/core/protocol/paho/client.py", line 617, in tls_set
raise IOError(certfile+": "+err.strerror)
OSError: : No such file or directory
prashidi@c889f3a91d4f iot-test-publish %
prashidi@c889f3a91d4f iot-test-publish %
prashidi@c889f3a91d4f iot-test-publish %
prashidi@c889f3a91d4f iot-test-publish %
prashidi@c889f3a91d4f iot-test-publish % python3 publish.py
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/AWSIoTPythonSDK/core/protocol/paho/client.py", line 615, in tls_set
f = open(certfile, "r")
^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: ''
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/prashidi/workspace/aws/iot/iot-test-publish/publish.py", line 19, in <module>
myAWSIoTMQTTClient.configureCredentials("certificates/AmazonRootCA1.pem")
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/AWSIoTPythonSDK/MQTTLib.py", line 246, in configureCredentials
self._mqtt_core.configure_cert_credentials(cert_credentials_provider, cipher_provider)
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/AWSIoTPythonSDK/core/protocol/mqtt_core.py", line 132, in configure_cert_credentials
self._internal_async_client.set_cert_credentials_provider(cert_credentials_provider, ciphers_provider)
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/AWSIoTPythonSDK/core/protocol/internal/clients.py", line 86, in set_cert_credentials_provider
self._paho_client.tls_set(ca_certs=ca_path,certfile=cert_path, keyfile=key_path,
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/AWSIoTPythonSDK/core/protocol/paho/client.py", line 617, in tls_set
raise IOError(certfile+": "+err.strerror)
OSError: : No such file or directory
Expected Behavior
The same code sample work for X.509 certificate authentication mode. However, I want to avoid the mTLS with the X.509 certificate
Current Behavior
Not working just throw the error: OSError: : No such file or directory while the certificate exist in that path
Reproduction Steps
Code sample I used:
import AWSIoTPythonSDK.MQTTLib as AWSIoTPyMQTT
import json
import time as t
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
# Define ENDPOINT, CLIENT_ID, PATH_TO_CERT, PATH_TO_KEY, PATH_TO_ROOT, MESSAGE, TOPIC, and RANGE
ENDPOINT = "endpoint-ats.iot.us-east-1.amazonaws.com"
CLIENT_ID = "a1b23cd45e"
# PATH_TO_CERT = "certificates/device.pem.crt"
# PATH_TO_KEY = "certificates/private.pem.key"
PATH_TO_ROOT = "certificates/AmazonRootCA1.pem"
AccessKeyId = "AAAAAAAAAAAAAA"
SecretKey = "DLFJLDJFLDJFLDJFLDJFLDFD"
MESSAGE = "Hello World"
TOPIC = "test/testing"
RANGE = 20
myAWSIoTMQTTClient = AWSIoTPyMQTT.AWSIoTMQTTClient(CLIENT_ID)
myAWSIoTMQTTClient.configureEndpoint(ENDPOINT, 443)
myAWSIoTMQTTClient.configureCredentials("certificates/AmazonRootCA1.pem")
myAWSIoTMQTTClient.configureIAMCredentials(AccessKeyId, SecretKey)
# myAWSIoTMQTTClient.configureCredentials(PATH_TO_ROOT, PATH_TO_KEY, PATH_TO_CERT)
myAWSIoTMQTTClient.connect()
print('Begin Publish')
for i in range(RANGE):
data = "{} [{}]".format(MESSAGE, i+1)
message = {"message": data}
myAWSIoTMQTTClient.publish(TOPIC, json.dumps(message), 1)
print("Published: '" + json.dumps(message) +
"' to the topic: " + "'test/testing'")
t.sleep(0.1)
print('Publish End')
myAWSIoTMQTTClient.disconnect()
You can just run this code sample with python3 fileName
Possible Solution
No response
Additional Information/Context
No response
SDK version used
v1.5.4 Latest
Environment details (OS name and version, etc.)
MacBook macOS 14.5
The text was updated successfully, but these errors were encountered:
Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.
Describe the bug
When trying to use the Sample provided for pub/sub with IAM authorization, I receive this error:
Expected Behavior
The same code sample work for X.509 certificate authentication mode. However, I want to avoid the mTLS with the X.509 certificate
Current Behavior
Not working just throw the error:
OSError: : No such file or directory
while the certificate exist in that pathReproduction Steps
Code sample I used:
You can just run this code sample with
python3 fileName
Possible Solution
No response
Additional Information/Context
No response
SDK version used
v1.5.4 Latest
Environment details (OS name and version, etc.)
MacBook macOS 14.5
The text was updated successfully, but these errors were encountered: