I have a lambda function with a graphql server tha...
# random
t
I have a lambda function with a graphql server that processes in ~ 1-2ms. If I randomly throw an error in it the response time goes up to to ~150ms. I suspect the amount of delay is correlated with sourcemap size. I believe inspecting or traversing the error as graphql does to generate messages is causing this but need to confirm So now I'm back to recommending disabling --enable-source-maps in production unless you have benchmarked it with exceptions being thrown
m
Should depend on the error frequency, no? If I'm getting a few an hour, that level of latency is worth the readable stack trace. If I'm getting 100 errors a second...maybe fix the errors? I've been recommending sourcemaps on.
t
The issue is I use them for control flow not just pure exceptions
eg asserting that the querying context has permissions, throwing an exception is a nice way to halt execution
m
Ah okay, well then yes, you're going to have to take a lot of latency. I never do that due to horrible experiences with spring framework 😛
t
You're right though that it still is the minority of situations where this even happens
This could also be fixed inside the
graphql
library but I need to dig into it to understand what is making it so slow
m
I did some benchmarks for sourcemaps and I believe they add latency, but only on exceptions. When did you start supporting them? Must've been recent (and I missed it).
t
It's sort of an invisible feature, we always dump sourcemap into the bundle
But unless you have the NODE_OPTIONS setting it won't do anything
m
I just found it in the docs. Cool.
g
Could be worse, I've had a fairly-large (i.e. not one function) project using Bluebird breaching the 5s
jest
limit 😄