Home
Support Forums

Netlify function times out

my website is nextflip.io

I know I know another post about the function timeout issue. But all the forum posts I’ve read so far it was because of an unclosed or hanging HTTP connection. my function doesn’t do any HTTP calls and completes in 1428ms locally. I can’t possibly imagine what would cause it to run over 10 seconds when published. It just reads some template files, replaces some variables in them, compiles the template and returns

Please help.

Hi @ihorbond

Welcome to the forums :netliconfetti:

In order to provide assistance, can you say how the function is triggered, and how someone wishing to test this for you would go about triggering it.

Sharing the repository you are deploying from would also help. If you can’t, or don’t wish to, share the repository, can you create a minimal reproduction for testing, or as a minimum provide the function code here.

Thanks for quick reply. I added bunch on console.log statements and looks like it hangs on this line

const output = JSON.parse(
        solc.compile(JSON.stringify(input), { import: findImports })
    );

it uses solidity compiler npm package solc-js. I wonder if me being on newer node version than the environment lambda runs in has something to do with it ? I will test on same node version locally.
I will create a repro repo, but if you’d like to trigger it from site it’s

POST https://nextflip.io/.netlify/functions/compile-smart-contract
{
   "blockchain":1,
   "network":"4",
   "hasWhitelist":false,
   "hasDelayedReveal":false,
   "hasOpenSeaRoyalties":true,
   "hasRaribleRoylties":false,
   "hasMintableRoylaties":false,
   "baseURL":"ipfs://",
   "name":"Bored Apes Yacht Club",
   "symbol":"BAYC",
   "collectionSize":555,
   "mintPrice":0.06,
   "email":"email@gmail.com"
}

UPDATE
Ran it with node v14.14 locally (I created my function after December 13th 2021 so I assume execution env defaults to node 14.14). It ran for 2s and then 1s the second time around

At this point, a reproduction would be more useful so we can see what’s happening.

@hrishikesh @coelmay here is the site with repro

and github repo

this one too works fine locally but times out lin prod. Thanks guys!

Yeah, I can see that happen. I found this interesting line from one of the issues:

Maybe that’s what’s happening?

I mean, I can already see it’s touching 500 MB usage right away:

Maybe it simply needs more RAM and CPU to make this work faster, but AWS won’t allow that.