Web3 API servers crashing consistently when calling getBlock

I’ll do some tests later too.

You could try to make a http request to a simple url in a cloud function to see if it still crashes when you call that cloud function multiple times.

Isn’t that what I just did? Not sure if you’re saying something different to this:

I’m not sure what you did there, something seems strange, maybe you need to make a POST request.

It was just this function, which I called repeatedly via http:

Moralis.Cloud.define("Hello", (request) => {
return `${request.params.name}`
});

Is that the kind of test you were asking me to do?

I don’t know where from you called this function, as in from another cloud function or directly form the sdk or local computer. What I wanted to say was closer to call it from another cloud function.

I was calling it over http like you asked. If you want me to run something specific I’m happy to, just send me the code

The idea is to make a http request from a cloud function. Similar on how you made a http request to call web3api with the api key. Now I’m thinking that it is something related to http requests made from a cloud function and not to web3api in particular.

I wasn’t using cloud functions when I posted this thread, I was using the sdk calling getBlock.

Yes, I know, but it seems that same problem happens when you call web3api from a cloud function by making a http request. That was my understanding.

Yes it happens when calling getBlock both ways. It’s not specific to using cloud functions.

The problem doesn’t happen when calling a cloud function that does basically nothing.

My assumption now is that it should happen also when calling a cloud function that makes a http request but not necessarily a http request to we3api.

Ok well I’ll let you do your testing. Let me know if you need anything from me

can you try with something like this:

Moralis.Cloud.define("test_web3_api", async (request) => {
  return Moralis.Cloud.httpRequest({
    type:"GET",
    url: 'https://deep-index.moralis.io/api/v2/web3/version',
     headers: {
      'accept': 'application/json',
      'X-API-Key': 'asfasdfasf'
     }
  }).then(function(httpResponse) {
    return httpResponse;
  }, function(httpResponse) {
    return httpResponse;
  });

})

as in something like this syntax to use web3api from a cloud function.

it looks like you used something like this:

Moralis.Cloud.define("get_block", (request) => {
return Moralis.Web3API.native.getBlock({chain:request.params.chain, block_number_or_hash:(request.params.block_number).toString()})
});

Why call Moralis.Cloud.httpRequest? I’m not using the server to make http requests, I’m using it to call getBlock.

is just a different way of getting the same result, you can use web3api without a server too, by making http results directly to deep-index

Ah cool, I didn’t know that was a thing. I could just be querying deep index directly then, let me give that a try.

Ok so using deep-index is doing the job as a workaround. Still not sure why the servers were crashing from calling getBlock though.

we will have a server update soon for that problem

Ok thanks for letting me know

can you test again with latest version of the server?