Abort Serverless Functions?

Hi there,

i have made a function using (Serverless Functions (API Endpoints) | RedwoodJS Docs) which basically acts as a proxy → on the client side, i call fetch(serverfunction?id=1234&prop=1234) what the server function does, is to look in the db for the id to query a url + key and then does the same fetch from the client again fetch(urlFromDB?prop=1234)

before this proxy i did send an abort request to the fetch() using an abort controller.

what i tried is to add a hook to the server.ts like so:

async function main() {
  const server = await createServer({
    logger,
    async configureApiServer(server) {
      server.addHook('onRequest', async (request) => {
        request.raw.on('close', () => {
        console.log(request.raw.aborted, request.raw.destroyed)
      if (request.raw.aborted) {
             server.log.info('request closed')
         }
       })
    })

    },
  })

  await server.start()
}

but it seems that the request does not stop the function :confused:

is it possible to send this abort signal to the function too to stop it from working?

Thanks a lot!!

Cheers