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

The provided API key is invalid #1013

Closed
bennycode opened this issue Jul 27, 2023 · 2 comments · Fixed by #1014 · 4 remaining pull requests
Closed

The provided API key is invalid #1013

bennycode opened this issue Jul 27, 2023 · 2 comments · Fixed by #1014 · 4 remaining pull requests
Labels

Comments

@bennycode
Copy link
Contributor

If you copy the code snippet from the Quick Start, you will encounter an error message stating "The provided API key is invalid". This happens because the code example doesn't explicitly indicate that "key" refers to the API key. Unlike other samples below that specifically mention process.env.GOOGLE_MAPS_API_KEY, this crucial detail should also be included in the quick start code:

const client = new Client({});

client
  .elevation({
    params: {
      locations: [{ lat: 45, lng: -110 }],
      key: "asdf",
    },
    timeout: 1000, // milliseconds
  })
  .then((r) => {
    console.log(r.data.results[0].elevation);
  })
  .catch((e) => {
    console.log(e.response.data.error_message);
  });
@wangela
Copy link
Member

wangela commented Jul 27, 2023

If you would like to upvote the priority of this issue, please comment below or react with 👍 so we can see what is popular when we triage.

@bennyn 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.

usefulthink added a commit that referenced this issue Sep 12, 2023
Replaces the invalid API key in the first example with an env-variable, making it clear it has to be provided by the user.

fixes #1013 
---------

Co-authored-by: Martin Schuhfuss <m.schuhfuss@gmail.com>
googlemaps-bot added a commit that referenced this issue Sep 12, 2023
### [3.3.38](v3.3.37...v3.3.38) (2023-09-12)

### Build System

* **deps-dev:** bump @types/node from 20.5.9 to 20.6.0 ([#1033](#1033)) ([dfca658](dfca658))
* **deps-dev:** bump prettier from 3.0.2 to 3.0.3 ([#1032](#1032)) ([798938f](798938f))
* **deps-dev:** bump typedoc from 0.25.0 to 0.25.1 ([#1031](#1031)) ([b1a7ef1](b1a7ef1))

### Documentation

* highlight API key in Quick Start example ([#1014](#1014)) ([22e6139](22e6139)), closes [#1013](#1013)
@googlemaps-bot
Copy link
Contributor

🎉 This issue has been resolved in version 3.3.38 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants