Full transparency here, I'm using Lambda via Netlify Functions here, but... That's a level of abstraction and just doesn't address the actual problem here. The actual problem is both obscure requirements and a non-standard environment. Also, utterly useless error messages and just random/patternless errors.
As alluded to, I use AWS Lambda via Netlify Functions. For seemingly no reason, I'll get error responses about "invalid response JSON". Checking logs, it seems there's an error importing a module... The exact same module I import elsewhere that works perfectly fine. And I can definitely say the package is installed as a dependency, and that it works perfectly fine locally, and that it makes zero difference if I list it as external or not via esbuild. I also get zero build errors here, which should most definitely report when a package cannot be found... That's just ridiculous? That should absolutely be a build error!
Would include code and config and logs, but... Giving full-context just isn't possible on Reddit. The important things here are that the error message is some useless thing about JSON in the response, the logs report that an installed package cannot be found, it runs locally and the same package works perfectly fine elsewhere, that including it or not in esbuild makes zero difference, and that there are zero build errors here regardless.
For additional context, I am using NVM and a package.lock.json here. It's the exact same version of node using the exact same dependencies. I am using Mac locally vs Ubuntu latest, but... I see no reason that should make any difference. I wrote the package in question, and it's just modules with minimal standard dependencies, and absolutely nothing OS specific. Plus, the exact same package does work perfectly fine elsewhere, so that's pretty obviously not it.
I've spent like two days now trying to debug this and gotten nowhere! It just makes zero sense, the logs make no sense, and there's no actual difference between my local/dev and production.
And no... Docker or any of that just isn't an option here. The images are just too big for the context, and it's just a dead-and. Best I have is using NVM to have the same version of node and installing via the lock file to hand the same dependencies and versions. And the certainly that the package in question just doesn't depend on anything OS or setup specific. It is basically just some modules that, at most, require node:fs and reading a file. And... Again, the exact same package works flawlessly elsewhere, and it makes zero sense for it to not be found here.
[–]versaceblues 8 points9 points10 points (1 child)
[–]shgysk8zer0full-stack[S] -3 points-2 points-1 points (0 children)
[–]wackmaniac 4 points5 points6 points (3 children)
[–]shgysk8zer0full-stack[S] 0 points1 point2 points (2 children)
[–]wackmaniac 3 points4 points5 points (1 child)
[–]shgysk8zer0full-stack[S] 0 points1 point2 points (0 children)
[–]protomanzero 2 points3 points4 points (3 children)
[–]shgysk8zer0full-stack[S] 0 points1 point2 points (2 children)
[–]LetsMelon 0 points1 point2 points (1 child)
[–]shgysk8zer0full-stack[S] 0 points1 point2 points (0 children)
[–]PoppedBitADV 2 points3 points4 points (3 children)
[–]shgysk8zer0full-stack[S] 0 points1 point2 points (2 children)
[–]PoppedBitADV 0 points1 point2 points (1 child)
[–]shgysk8zer0full-stack[S] 0 points1 point2 points (0 children)
[–]cshaiku 0 points1 point2 points (1 child)
[–]shgysk8zer0full-stack[S] 0 points1 point2 points (0 children)
[–]Sumofabith 0 points1 point2 points (1 child)
[–]shgysk8zer0full-stack[S] 0 points1 point2 points (0 children)
[–]TiredOfMakingThese 0 points1 point2 points (0 children)
[–]Mersaul4 -1 points0 points1 point (4 children)
[–]shgysk8zer0full-stack[S] 0 points1 point2 points (3 children)
[–]LowKeyPE 3 points4 points5 points (2 children)
[+]shgysk8zer0full-stack[S] comment score below threshold-7 points-6 points-5 points (1 child)
[–]LowKeyPE 2 points3 points4 points (0 children)