Support Forums

Netlify function can't resolve api fetch pending state and times out

My sites url: https://www.getmelo.io/

Hey, Felix here! I deployed my code to Netlify with a Heroku Postgres DB, but get really slow response time from a very simple subscription form only checking with .findUnique if the email is there and after .create it with the prisma client. From localhost to prod DB it only takes 1-2s, but from Netlify it takes about 10s to write the mail to the database. Where can be the bottleneck?

I did further research and found that Netlify can’t resolve the api fetch and is staying in “pending” state for 10s until it times out, but giving the correct database response and inserts the data.

1:03:46 PM: c5f1b177 INFO   [request] /api
1:03:56 PM: c5f1b177 Duration: 10010.61 ms    Memory Usage: 187 MB    1:03:56 PM: c5f1b177 ERROR  Task timed out after 10.01 seconds1:03:58 PM: 2021-06-01T11:03:58.250Z    undefined    ERROR    (node:8) [DEP0131] DeprecationWarning: The legacy HTTP parser is deprecated.
1:08:27 PM: b267f776 INFO   [request] /api

I’m using @prisma/client@~2.19.0 with prisma@~2.19.0 and nexus-plugin-prisma@~0.33.0 The inserting logic is

          onClick={() => {
            }).then((result) => {
              if (result.data?.createSubscriber?.email) {
              } else {

together with:

    t.nullable.field("createSubscriber", {
      type: "Subscriber",
      args: {
        email: nonNull(stringArg()),
      resolve: async (_, args) => {
        const alreadySubscribed = await prisma.subscriber.findUnique({
          where: {
            email: args.email,

        if (alreadySubscribed) return null;
        return await prisma.subscriber.create({
          data: {
            email: args.email

hi there felix, thanks for your patience. we haven’t forgotten about this question, and are still hoping to get some answers for you soon.

Hey there @felixhaeberle :wave:

Thanks for your patience here. I see that you were able to work through this with @lindsaylevine
on our netlify-plugin-nextjs repo! For any future Forums members reading this, I encourage you to engage on the repo if you are having a similar issue!