Coder Social home page Coder Social logo

Comments (2)

AlphaWong avatar AlphaWong commented on September 26, 2024

hi

May I confirm with you about the step to setup?

  1. create a project ( the billing is enabled by default )
  2. create an API key in by click Create credentials > API key.
  3. disable the billing for this project.

the error message will be shown as follow?

{
  "error": {
    "code": 404,
    "message": "Requested entity was not found.",
    "status": "NOT_FOUND"
  }
}

my raw query ( please replace YOU_KEY field )

curl --request GET \
  --url 'https://roads.googleapis.com/v1/nearestRoads?points=60.170880%2C24.942795%7C60.170879%2C24.942796%7C60.170877%2C24.942796&key=YOU_KEY'

my guess

I think it did throw an error, you can find err = json.NewDecoder(httpResp.Body).Decode(resp) will return an error as the response with error cannot mapped to resp which is a reference from response := &NearestRoadsResponse{}

func (c *Client) getJSON(ctx context.Context, config *apiConfig, apiReq apiRequest, resp interface{}) error {
	requestMetrics := c.metricReporter.NewRequest(config.path)
	httpResp, err := c.get(ctx, config, apiReq)
	if err != nil {
		requestMetrics.EndRequest(ctx, err, httpResp, "")
		return err
	}
	defer httpResp.Body.Close()

	err = json.NewDecoder(httpResp.Body).Decode(resp)
	requestMetrics.EndRequest(ctx, err, httpResp, httpResp.Header.Get("x-goog-maps-metro-area"))
	return err
}

from google-maps-services-go.

twa16 avatar twa16 commented on September 26, 2024

Thanks for the response. I agree that the underlying raw API call throws the error. I think the issue is that unlike the geocoding go call, the error does not get propagated up to the developer. There may very well be an internal error but to the developer using the gmaps golang library, it looks like a silent failure.

As for reproduction, billing was not enabled by default but I imagine having a project with billing explicitly disabled will reproduce the issue.

from google-maps-services-go.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.