Closed BakhmudovR79 closed 10 months ago
Can you share the actual code (with dummy values) with what you are calling. Not sure why accepting a string would be needed when a port is an int value. I'm also not sure why an authentication problem would be caused by a port value as it happens after the connection but seeing the code will help get to the bottom of that.
Hi Jordan,
Thanks for quick reply. Trying to create a simple example with direct call to smbclient and giving port as string, now I got different error: [ERROR] TypeError: %d format: a real number is required, not str
Example code is simple: `import json import smbclient import os import logging
logger = logging.getLogger() logger.setLevel("INFO")
def lambda_handler(event, context): server = "server_name" shareFolder = "share_folder" smbclient.register_session(server=server, port="445", username="user", password="password") print(smbclient.listdir(os.path.join(server, shareFolder)))`
I will try to recreate previously mentionned behaviour and will get back with code.
I think that port number
is a number not text.
Have you tried?
-smbclient.register_session(server=server, port="445", username="user", password="password")
+smbclient.register_session(server=server, port=445, username="user", password="password")
Closing as per the above, currently the port
argument must be a string. Maybe in the future we can automatically cast it but it's not really that much of a burden for the caller to ensure it's an int themselves.
While trying to connect from lambda to Windows FSx Share, I was getting the error: [ERROR] 2023-08-22T03:42:23.207Z 2f310e7a-0f9d-475d-904d-cd4cba4abf17 An error occurred: Failed to authenticate with server: SpnegoError (1): SpnegoError (16): Operation not supported or available, Context: Retrieving NTLM store without NTLM_USER_FILE set to a filepath, Context: Unable to negotiate common mechanism
Spend quite a time to figure out that actually I was passing port as a string. When changed to int, everything started to work well.