Wix fetch sometimes doesn't work

Hi everybody.
I have a problem. I’ve spent a lot of time for it. If you know resolving or at least what can I try, please, tell me.
What can I try?
Thank you a lot!

I use wix fetch for request JSON data from other servers.
One code can work at one moment, but doesn’t work to other moment. For example.

Backend block named funcBackend.jsw

export function test() {
return fetch(
 'https://api.travelpayouts.com/data/airports.json',
      {'method': 'GET'}
    )
    .then((response) => {
 return response.json();
    })
}

My main code is:

import {test} from 'backend/funcBackend.jsw';
export function button4_click(event, $w) {
  test()
  .then((res) => {
    console.log(res);
  })
}

This code can work at one moment, but doesn’t work to other moment. Sometimes I can’t get an answer from the server. Error is:


If I just try to put this https://api.travelpayouts.com/data/airports.json to address line in browser, server returns a result always without problem.

By the way, if I try to connect to other server, it works always

export function test() {
return fetch(
 //https://api.travelpayouts.com/data/airports.json',
 'https://yasen.aviasales.ru/adaptors/currency.json',
      {'method': 'GET'}
    )
    .then((response) => {
 return response.json();
    })
}
1 Like

I am having the same problem. Its a problem with the wix-fetch timeout. If the API takes longer than 14 seconds to reply, then the res timesout. ~Wix, this is critical to our site is there any way to make the timeout longer for fetch?