Going mad here folks, please help! I decided to restructure a function into different modules, exactly like the testing guidance gives, to separate the app logic from the provider needs.
However, unless I provide an absolute pathname in the require, sis involve local says can’t find file. Running on AWS I can’t figure how to get it to find the additional module however I specify it. I’ve read the piece on packaging but it doesn’t seem to match, as when I inspect the uploaded zip file on s3, everything I need is there, it just can’t reference it.
I have a function specified in server less.yml as -
functions:
get:
handler: functions/aws/licenses/get.get
In this function I have a require(‘validator’) statement (this is the one I’ve been trying with relative paths etc to no avail)
I also have an additional module in validator.js in
functions/app/validator.js
Logically, I’d have thought the require statement would be require(’./functions/app/validator’);
I’ve tried every combination I can think of, including this from stack overflow http://stackoverflow.com/questions/37669198/how-to-load-a-lib-folder-in-aws-lambda
I’ve probably tied my brain in knots now and need some help!
Thanks