title: typescript: listServiceLevelObjectives gives UnhandledPromiseRejectionWarning: Error: 3 INVALID_ARGUMENT
body: <p>I'm trying to get list of SLOs in google cloud project through REST API using typescript, but receiving an error. Could you help me please. Error is:</p>
  <blockquote>
  <p>(node:47173) UnhandledPromiseRejectionWarning: Error: 3 INVALID_ARGUMENT: Received invalid service name: [object Object] at Object.callErrorFromStatus (/Users/mpanova/workspace/node/monitoring-automation/node_modules/@grpc/grpc-js/src/call.ts:81:24) at Object.onReceiveStatus (/Users/mpanova/workspace/node/monitoring-automation/node_modules/@grpc/grpc-js/src/client.ts:334:36) at Object.onReceiveStatus (/Users/mpanova/workspace/node/monitoring-automation/node_modules/@grpc/grpc-js/src/client-interceptors.ts:434:34) at Object.onReceiveStatus (/Users/mpanova/workspace/node/monitoring-automation/node_modules/@grpc/grpc-js/src/client-interceptors.ts:397:48) at Http2CallStream.outputStatus (/Users/mpanova/workspace/node/monitoring-automation/node_modules/@grpc/grpc-js/src/call-stream.ts:230:22) at Http2CallStream.maybeOutputStatus (/Users/mpanova/workspace/node/monitoring-automation/node_modules/@grpc/grpc-js/src/call-stream.ts:280:14) at Http2CallStream.endCall (/Users/mpanova/workspace/node/monitoring-automation/node_modules/@grpc/grpc-js/src/call-stream.ts:263:12) at Http2CallStream.handleTrailers (/Users/mpanova/workspace/node/monitoring-automation/node_modules/@grpc/grpc-js/src/call-stream.ts:412:10) at ClientHttp2Stream.emit (events.js:314:20) at emit (internal/http2/core.js:291:8) at processTicksAndRejections (internal/process/task_queues.js:83:22) at emitUnhandledRejectionWarning (internal/process/promises.js:168:15) at processPromiseRejections (internal/process/promises.js:247:11) at processTicksAndRejections (internal/process/task_queues.js:94:32)</p>
  </blockquote>
  <p>To be honest I'm new to Typescript, usually I use Java, so may be an error is stupid and simple.</p>
  <p>My code is:
  <strong>list_slos.ts in source directory</strong></p>
  <pre><code>export module ListSloTest {
      export async function listSlos(projectId: string) {
          // Imports the Google Cloud client library
          const monitoring = require('@google-cloud/monitoring');
  
          // Creates a client
          const client = new monitoring.ServiceMonitoringServiceClient();
  
          const request = {
              parent: client.projectPath(projectId),
          };
          console.log(projectId)
  
          const [slos] = await client.listServiceLevelObjectives({parent: request});
  
          slos.forEach((slo: any) =&gt; {
              console.log('');
              console.log('slo: %j', slo);
          });
  </code></pre>
  <pre><code>**list_slos.ts in test directory**
  </code></pre>
  <pre><code>import &quot;mocha&quot;;
  import * as assert from &quot;assert&quot;;
  import {ListSloTest} from &quot;../dist/list_slos&quot;;
  
  describe(&quot;list_slos&quot;,()=&gt;{
  
      before(function () {
          process.env = {GOOGLE_CLOUD_PROJECT: 'projectId',
              GOOGLE_APPLICATION_CREDENTIALS: '/somePath/projectId-a17ce3d7c2e6.json'};
      });
  
      it(&quot;should list slos in given project&quot;,()=&gt;{
  
          ListSloTest.listSlos(&quot;projectId&quot;);
          //console.log(&quot;hello, world!&quot;)
          assert.ok(true);
  
      });
  
  });
  </code></pre>
  <p>I'm compiling code from source to dist directory and then use it in test.</p>