I'm completing a code re-organization that involves my project having new tsconfig.json and package.json files, along with directory re-orgs and more. Lots of opportunities for bugs to have crept in. I'm down to one, which happens during the serialization of an inline function (for an AWS CallbackFunction lambda). Its having problems deciding what "fs" is. Code and error message in thread.
This all worked before the re-org. No Typescript code change. Plenty of changes in package.json, tsconfig.json, etc. Any theories? Pointers on where to start looking?
It's happening during
as can be inferred from the "Error serializing..." message, so it's not that the lambda itself is broken (though it may well be...).
I've worked around it for now by removing the call to fs.readFileSync() from inside the lambda, and instead passing the contents of the read file as a string via an env var. I'd still like to know what's changed, as it may be causing other subtle bugs.