title: Node and DialogFlow Error: UnhandledPromiseRejectionWarning: TypeError: sessionClient.projectAgentSessionPath is not a function
body: <p>I'm trying to connect from Nodejs to DialogFlow. I have completed all the steps to configure the user agent, the intent, etc. If I lunch with NODEMON the app, all its ok, but when I send a GET or POST request I get this error:
  &quot;UnhandledPromiseRejectionWarning: TypeError: sessionClient.projectAgentSessionPath&quot; and more. But I think the most relevant mistake is this.
  The code I used it's the same as the APi docs. I don't know why I get this error.</p>
  <pre><code>const express = require('express');
  const bodyParser = require('body-parser');
  const app = express();
  const dialogflow = require('@google-cloud/dialogflow');
  const uuid = require('uuid');
  //const sendReq = require('./reqDialogFlow');
  
  async function runSample(projectId = 'helpcenter-qwoj') {
  // A unique identifier for the given session
  const sessionId = uuid.v4();
  
  // Create a new session
  const sessionClient = new dialogflow.SessionsClient();
  
  
  const sessionPath = sessionClient.projectAgentSessionPath(projectId, sessionId);
  console.log(sessionPath);
  // The text query request.
  const request = {
      session: sessionPath,
      queryInput: {
          text: {
              // The query to send to the dialogflow agent
              text: 'hello',
              // The language used by the client (en-US)
              languageCode: 'it',
          },
      },
  };
  
  // Send request and log result
  const responses = await sessionClient.detectIntent(request);
  console.log('Detected intent');
  const result = responses[0].queryResult;
  console.log(`  Query: ${result.queryText}`);
  console.log(`  Response: ${result.fulfillmentText}`);
  if (result.intent) {
      console.log(`  Intent: ${result.intent.displayName}`);
  } else {
      console.log(`  No intent matched.`);
  }
  };
  
  
   app.get('/', (req, res) =&gt; {
          res.send({ &quot;hello&quot;: &quot;Daniele Asteggiante&quot; })
      });
      
   app.post('/api/textAPIE', (req, res) =&gt; {
          res.send({ &quot;text&quot;: &quot;CIAO&quot; });
          runSample();
  
  });
  
  app.use(bodyParser.json());
  
  
  const PORT = process.env.PORT || 5000;
  app.listen(PORT);
  </code></pre>