I'm trying to follow the graphql examples from pri...
# orm-help
a
I'm trying to follow the graphql examples from prisma (and using it with lambda). It's working, but I'm receiving really slow responses with serverless-offline. 3-10 seconds locally. Am I doing something wrong? The same server, with the standard apollo server, no sls-offline is in a few milliseconds max
Copy code
...

exports.graphqlHandler = (
  event: APIGatewayProxyEvent,
  context: Context,
  callback: APIGatewayProxyCallback
) => {
  context.callbackWaitsForEmptyEventLoop = false

  const server = new ApolloServer({
    schema: schema,
    context: schemaContext,
  })

  const handler = server.createHandler()

  return handler(event, context, callback)
}
r
Hi @aniraga - I did this a couple of years ago but from what I remember the code should be the same. If you are using a database, is it local or one on the internet and could that be the issue? A good place to start would be to put in some logging and see where the slowdown is - is it: • between sending the request and the "offline lambda" starting and receiving it? • between the started server and the resolver being called? • between the start of the resolver and when it returns? • between the return and when you receive your response to your initial request
a
Thanks - it's honestly much better in non sls-offline, and some things are a bit strange in sls-offline, so I may just continue as is for now
r
@aniraga 👋 Depends on where you’ve hosted the DB. If it’s in a separate region as where you’re working from, it would take around 3 seconds to get the response.
a
It's all running locally unfortunately via sls-offline (against a local db). But, I do think it was just a problem locally (deployed, times look fine)
Thanks!