Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Required header X-Goog-Fieldmask missing in Routes API sample code #5970

Open
6 tasks done
NateWr opened this issue Jan 18, 2025 · 0 comments
Open
6 tasks done

Required header X-Goog-Fieldmask missing in Routes API sample code #5970

NateWr opened this issue Jan 18, 2025 · 0 comments
Labels
samples Issues that are directly related to samples.

Comments

@NateWr
Copy link

NateWr commented Jan 18, 2025

Please make sure you have searched for information in the following guides.

Documentation Request

When using the sample code for the Routes API, I received the following error message:

Error: 3 INVALID_ARGUMENT: FieldMask is a required parameter. See https://cloud.google.com/apis/docs/system-parameters on how to provide it. As an example, you can set the header 'X-Goog-FieldMask' to value 'routes.distanceMeters,routes.duration,routes.polyline.encodedPolyline' to ask for the route distance, duration, and polyline in the response. You can also set the value to '*' in manual testing to get all the available response fields. However, using the '*' wildcard is discouraged in production.

To fix this, I had to change the following line:

const response = await routingClient.computeRoutes(request);

I had to pass a X-Goog-Fieldmask header:

const response = await routingClient.computeRoutes(request, {otherArgs: {headers: {'X-Goog-Fieldmask': '*'}});

Should the documentation be updated to include the field mask? Or did I encounter an unusual edge case of some kind?

@product-auto-label product-auto-label bot added the samples Issues that are directly related to samples. label Jan 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
samples Issues that are directly related to samples.
Projects
None yet
Development

No branches or pull requests

1 participant