I have a lambda function that is returning back an error that no such file or directory has been found.
To be clear the image below shows the file structure exists in my lambda and it is clear that the directory that I am looking for does exist.
My current file structure in the lambda function
Error Message that I am receiving:
[ERROR] FileNotFoundError: [Errno 2] No such file or directory: 'config'
Traceback (most recent call last):
File "/var/task/lambda_function.py", line 23, in lambda_handler
os.chdir("config")
Below is the lambda_handler:
import os
import json
def lambda_handler(event, context):
print(event)
os.chdir("config")
loginInfo = json.load(open('secrets.json'))
return loginInfo
The reason why I am changing the directory to config is so that I can access my secrets.json file.
Please let me know if this is sufficient detail to reproduce.