Lambda container reuse
In high traffic environments lambda reuses the same container to serve multiple requests. The lambda adapter appears to create a new Context inside the handler for each request. Is there any way to keep things like database connections and s3 clients in the global scope outside of the handler? We sometimes see lambdas fail due to running out of file descriptors when many connections are spawned from the same container.
santi•41d ago
Also facing the same issue. Did you figure this out @swammer ?
swammer•41d ago
No, I implemented a temporary workaround. I'll keep digging eventually and let you know if I figure out how to fix the root cause
santi•41d ago
Any hint in terms of your workaround?
4.8KMembers
View on DiscordMore Posts
Trouble with Vercel and deployment URLHey I've been having a problem with nextjs deploying to vercel. In localhost the calls to the backen1 trpc api server for 1 or many clients.I'm a beginner, working on two monorepo projects that resides on the same folder, each of which withError formatting with trpcExpress.createExpressMiddlewareI'm trying to figure out how to do error formatting but it's unclear how to do it in the context of Tried to access "$types.prototype" which is not available at runtimeIm getting this weird errors every thing was good until I migrated to trpc 11 which for some reason type safety with metahow do I get the meta types to work correctly?Confused by the many examples and docs of implementing trpc, next.js (app router), and clerk.To show an examples of the many variants an implementations here is an example:
In TRPC Docs: httpTypeError: cache is not a functionTrying to run vitest integration testing on a procedure but i keep running into errors with a "cacheCan't throw errorMy request is pending although throw new TRPCError() executed. Something wrong here?