googlemaps / google-maps-services-js

Node.js client library for Google Maps API Web Services
Apache License 2.0
2.88k stars 634 forks source link

GeoCode: request error over geocode API #1025

Open frank-zsy opened 1 year ago

frank-zsy commented 1 year ago

Environment details

  1. Specify the API: GeoCode
  2. OS type and version: MacOS Ventura
  3. Library version and other environment information: 3.3.36

Steps to reproduce

  1. Run the code below in bash with Node.js 14.3.0

Code example

try {
  const result = await client.geocode({
    params: {
      key: 'my_key',
      address: 'Log Angeles, CA',
    },
  });
  console.log(result);
} catch (e: any) {
  console.log(e.response.data.error_message);
}

This is quite simple demo to get geocode of an address using GeoCode API. The key is set and there is no any restrictions over the key.

But I got Requests to this API must be over SSL. Load the API with "https://" instead of "http://". and HTTP status code 403 as error message for the request. Is there any other configs or options to enable HTTPS or should I specify the endpoint manually? I can not find solution or documentation about this.

Thanks.

wangela commented 1 year ago

If you would like to upvote the priority of this issue, please comment below or react on the original post above with :+1: so we can see what is popular when we triage.

@frank-zsy Thank you for opening this issue. 🙏 Please check out these other resources that might help you get to a resolution in the meantime:

This is an automated message, feel free to ignore.

frank-zsy commented 1 year ago

update: the old SDK @google/maps works fine though.

usefulthink commented 11 months ago

your example works as expected on my machine with almost the same setup. Can you share a full example (including creating the client etc.)?