Nextjs api_route runs locally but "Task timed out" when deployed

endpoint : https://xenodochial-goldstine-c73569.netlify.app/api/user

function:

import { Client, Get, Ref, Collection } from "faunadb";

export default function handler(req, res) {
const client = new Client({
  secret: process.env.FAUNA_KEY,
});

client
  .query(Get(Ref(Collection("user"), "295938095420801541")))
  .then((doc) => res.json(doc));
}

I checked the .env variables 10x (it’s correct)

error:

{"errorMessage":"2021-04-15T11:48:43.889Z d6e05891-4222-48c1-9f37-e8f857fefaea Task timed out after 10.01 seconds"}

Any idea what I’m doing wrong?

Hey there, @Jouwdev Welcome to the Netlify Forums! :netliconfetti:

I suspect this thread about 10.01 second timeouts and functions may be related to the issue you are encountering here. Take a look!