I can't assess to google map api

I have a problem to load google map api…
what happened?

This seems like a CORS problem. CORS is a security model that prevents a browser to make calls to other domains from the page origin (in wix code case, the wix code worker). You can make calls from the backend or from the browser to services that implement CORS protocol over HTTP.

The safest option is to move the fetch code into a web module in the backend folder and import it from there.

will look something like

map-api.jsw

import {fetch} from 'wix-fetch';

export function searchMaps(from, to) {
  return fetch(...) ... // your code here
}

from the page code

import {searchMaps} from 'backend/map-api';

$w.onReady(() => {
  searchMaps
    .then(res => {
      // do something with the result
    });
})