question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Timeouts on Netlify

See original GitHub issue

Hi,

we’ve updated to the latest version and since then our functions on Netlify time out. Exactly on the line where we connect to redis, no exceptions or anything just a timeout after 10 seconds.

Locally via netlify dev everything works.

Any idea what changed that could cause this?

const { Redis } = require("@upstash/redis");

const redis = new Redis({
  url: process.env.UPSTASH_REDIS_REST_URL,
  token: process.env.UPSTASH_REDIS_REST_TOKEN,
});


module.exports.handler = async (event, context) => {
  // only allow GET requests
  if (event.httpMethod !== "GET") {
    return {
      statusCode: 405,
      body: JSON.stringify("Method not allowed."),
    };
  }

  try {

    const siteId = event.path.replace("/some-path/", "").split("/")[0];

   console.log('blah'); // works...
   const data = await redis.get(siteId); // timeout after 10 seconds
   console.log('nope'); // never logs...
...
...

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:10

github_iconTop GitHub Comments

1reaction
madsemcommented, Jul 28, 2022

You’re a rockstar @chronark 😃

Thanks very much, appreciate you.

1reaction
chronarkcommented, Jul 28, 2022

The only difference between the two is ../with-fetch has an additional import

import "isomorphic-fetch"

Importing it while you are using node18 works without issues, as it only polyfills if fetch is not available. So I doubt it will cause troubles, but of course i can not vouch for another dependency.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Function timeout increase - Netlify Support Forums
Our webhook usually completes in under 10 seconds, but every month we have a couple that time out, causing us to lose data....
Read more >
Request timeout - Admin - Netlify Support Forums
How can I increase the function timeout of my sites? Ideally, we would want our timeouts to be maxed on all our sites...
Read more >
Serverless-http timeouts on netlify functions local enviroment
Anyone has good idea? All serverless function time out after 10 seconds by default (an increase to 26 seconds is possible.) Serverless ...
Read more >
Netlify Function Timeout after 10 seconds when published
Hi Netlify Community! I'm trying to make a query to Firebase firestore with in a Netlify function which works perfectly fine when developing...
Read more >
Function timeout increase - Netlify Support Forums
If you upgrade to the Pro Team plan or above, please let us know and we'll be able to increase the Functions timeout...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found