Lambda Functions Return 504 Intermittently, On Different Browsers, and Across Netlify Sites

I have a site that was released publicly today and has had close to a month or more of testing without issues and without significant changes. The netlify URL for the site is https://governing-simulations.netlify.app/, and it is also available at https://deathvalue.fyi.

My app requests data asynchronously from a netlify-managed Lambda Function once the main page has loaded. What the user will see during this state is a “Loading” message, followed by the full UI loading into view once the data has been fetched.

As of today - for the first time - I am noticing a very concerning issue where the page will be stuck in this “Loading” state indefinitely - but only intermittently, and inconsistently across browsers. Upon inspection of the network requests in the console, I will see the following:

GENERAL

Request URL: https://governing-simulations.netlify.app/.netlify/functions/serveVslReport
Request Method: GET
Status Code: 504 
Remote Address: [2604:a880:400:d0::caa:3001]:443
Referrer Policy: no-referrer-when-downgrade

RESPONSE HEADERS

cache-control: no-store
content-language: en
content-length: 2
content-type: text/html
date: Tue, 19 May 2020 23:37:27 GMT
server: Netlify
status: 504
x-nf-request-id: 3101047a-dd00-4292-9867-7f82b500948b-5967920

REQUEST HEADERS

:authority: governing-simulations.netlify.app
:method: GET
:path: /.netlify/functions/serveVslReport
:scheme: https
accept: application/json, text/plain, */*
accept-encoding: gzip, deflate, br
accept-language: en-US,en;q=0.9
cookie: (REDACTED)
referer: https://governing-simulations.netlify.app/
sec-fetch-dest: empty
sec-fetch-mode: cors
sec-fetch-site: same-origin
user-agent: (REDACTED)

The weirdest part here is that when this does happen, it may or may not also happen in different browsers. The only shared behaviour between browsers Im seeing is that once it does get stuck in this state, it takes maybe 10 minutes (I havent timed this) to get out of it, per browser.

Furthermore, I began discussing this with another developer friend of mine and he told me he is seeing it too on his own Lambda function he is developing. Exact same behaviour, and his Lambda function simply returns text – it’s almost a Hello World. Your status page says everything is fine.

Edit:

I thought I should add the payload Im sending from my Lambda Function, which does contain cache controls via the Cache-Control header. I have no good reason to think this should be breaking things, but maybe?

        resolve({
          statusCode: 200,
          headers: {
            'Cache-Control': 'public, s-maxage=3600', // Cache for up to 1 hour.
            'Content-Type': "application/json; Charset=UTF-8",
          },
          body: JSON.stringify(serializedData)
        });

Edit 2:

Ive temporarily disabled the Cache-Control header, in case that is the issue. No noticeable change but unsure if that takes time to go into effect.

1 Like

Same exact issue here, so I will watch this thread and provide what info I can.

Also same exact issue. It seems to be have been back and forth between working and not working all day.

My return headers are:
“Access-Control-Allow-Origin” : “*”,
“Access-Control-Allow-Headers”: “Content-Type”

Hi, @bradleygriffith, we do see an increase in 504 responses today for Functions. Our Site Reliability Engineers are working on this issue now. We’ll post another update here as soon as we know more.

3 Likes

we do believe we have since mitigated this issue. Are you continuing to see this behaviour?

I haven’t noticed it today. Can’t say for sure that that means it’s gone, but seems to have been good for a while. Thanks for the update.

1 Like