Aws Lambda Fs.readfile Issue
I'm packing some files in my lambda package that I need. I've used some example floating around to nearly get it working. I'm able to verify the path of a file OK const deviceCert
Solution 1:
Copied from the node.js path.resolve() API documentation:
The path.resolve() method resolves a sequence of paths or path segments into an absolute path.
In other words, resolve
concatenates a sequence of strings into one string, formatted as an absolute path. However, it does not check whether or not there is a file at this location. You can use either fs.stat() or fs.access() to verify the presence and access of the file.
Solution 2:
eventually confirmed that serverless was packaging the files I needed.
Using fs.readdir I was able to debug the issue and find the path that the packaging process was creating in the Lambda package
/var/task/src//Certs/
Hope this helps someone in the future!!
Post a Comment for "Aws Lambda Fs.readfile Issue"