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

Null value error getting client #1581

Closed
radianceltd opened this issue Jan 7, 2020 · 1 comment
Closed

Null value error getting client #1581

radianceltd opened this issue Jan 7, 2020 · 1 comment
Assignees
Labels
type: question Request for information or clarification. Not an issue.

Comments

@radianceltd
Copy link

radianceltd commented Jan 7, 2020

I use the following code to get the client:

// [START iot_get_client]
// Returns an authorized API client by discovering the Cloud IoT Core API with
// the provided API key.
const getClient = async serviceAccountJson => {
  // the getClient method looks for the GCLOUD_PROJECT and GOOGLE_APPLICATION_CREDENTIALS
  // environment variables if serviceAccountJson is not passed in
  const authClient = await google.auth.getClient({
    keyFilename: serviceAccountJson,
    scopes: ['https://www.googleapis.com/auth/cloud-platform'],
  });

  const discoveryUrl = `${DISCOVERY_API}?version=${API_VERSION}`;

  google.options({
    auth: authClient,
  });

  try {
    return google.discoverAPI(discoveryUrl);
  } catch (err) {
    console.error('Error during API discovery.', err);
  }
};
// [END iot_get_client]

When I read the client API, Getclient returned to me like this, I don't know how to call const {data} = await client.projects.locations.registries.devices.list (request); the data data

image

I don't know why this code doesn't work。

If the above client code fails to run, the following code will fail to run

image

Help me to analyze the reason.

@yoshi-automation yoshi-automation added the triage me I really want to be triaged. label Jan 7, 2020
@fhinkel fhinkel added type: question Request for information or clarification. Not an issue. and removed triage me I really want to be triaged. labels Jan 8, 2020
@hongalex
Copy link
Contributor

hongalex commented Jan 9, 2020

I believe this a duplicate of issue #1579

@hongalex hongalex closed this as completed Jan 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: question Request for information or clarification. Not an issue.
Projects
None yet
Development

No branches or pull requests

4 participants