Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Error creating an app Engine from discoveryengine using type SOLUTION_TYPE_CHAT

Hello

I'm trying to create a Chat Engine using node js and the module discoveryengine, this creation offers different type of options like SOLUTION_TYPE_RECOMMENDATION, SOLUTION_TYPE_GENERATIVE_CHAT, SOLUTION_TYPE_CHAT, most options work´s fine but when I tried to create an engine type SOLUTION_TYPE_CHAT, the response is always the same:

Error creating engine: Error: 13 INTERNAL: Internal error encountered. Please try again. If the issue persists, please contact our support team.

I appreciate if somebody can help me, because i don't undestand what I`m doing wrong.

I share the code i`m using:

const {EngineServiceClient} = require('@google-cloud/discoveryengine').v1beta;
const client = new EngineServiceClient();

const request = {
  parent: `projects/YOUR_PROJECT_ID/locations/global`,
  engineId: "engine-test-569",
  engine: {
    displayName: "local Bot",
    solutionType: "SOLUTION_TYPE_CHAT",
    dataStoreIds: ["test-5454654"],
 }
};

try {
        const [operation] = await client.createEngine(request);
        // Wait for the operation to complete
        const [response] = await operation.promise();

        console.debug('Engine created successfully:', response);
  } catch (error) {
        console.error('Error creating engine:', error);
  }

In addition to this, i want to relate this engine with an existing agent created with dialogflow cx.

1 REPLY 1

Hi @ccardenass85,

Welcome to Google Cloud Community!

Here are some strategies you can consider to potentially resolve your issue:

  1. Permissions/Service Account:
  • Verify the service account: Make sure the service account you're using (the one associated with your Node.js application and used for authentication with the Discovery Engine API) has the necessary IAM roles
  • Enable the API: Double-check that the Discovery Engine API is enabled for your Google Cloud project.
  1. Data Store Configuration:
  • Existence: Ensure the dataStoreIds: ["test-5454654"] datastore actually exists and is in the same project/location. A typo or incorrect ID will cause this kind of error.
  • Relevance: Is the datastore suitable for a chat engine? Make sure it's indexed correctly and contains data that can be used for conversational responses.
  1. Resource Conflicts/Limits:
  • Name collisions: While unlikely with a generated name, ensure the engineId ("engine-test-569" in your case) isn't already in use within your project. Even deleted engines might cause temporary conflicts. Try a different, unique ID.
  • Project limits: It's possible you've reached a project-level limit on the number of Discovery Engine resources. Check the Google Cloud console for quotas.
  1. API Version/Client Library:
  • Latest version: Ensure you're using the latest version of the @ google-cloud/discoveryengine library. Outdated versions can have bugs or compatibility issues. Run npm update @ google-cloud/discoveryengine
  • API issues: There could be a temporary issue with the Discovery Engine API itself. Check the Google Cloud status dashboard for any reported outages or problems. Try again later.
  1. Retry Logic:
  • Due to the transient nature of "INTERNAL" errors, implement retry logic in your code. Wrap your createEngine call in a loop that retries a few times with exponential backoff (increasing the delay between retries).
  1. Region:
  • While you're using locations/global, confirm that the datastore you're referencing is accessible from the global location or consider creating the engine in the same region as the datastore if the datastore isn't configured for multi-region access.

In addition, if you want to relate the Discovery Engine chat engine to an existing Dialogflow CX agent, you may consider the following:

1. Agent Setup:

  • Dialogflow CX Agent: You need a Dialogflow CX agent already created.
  • Route to the Chat Engine: Within your Dialogflow CX agent, you'll need to configure a route (typically an intent route) that will trigger the interaction with the Discovery Engine. This often involves using a webhook.

2. Webhook Implementation:

  • Create a Webhook Service: You'll need to create a service (e.g., a Cloud Function, Cloud Run, or an endpoint on your own server) that acts as a webhook.
  • Authentication: Your webhook will need to authenticate with both Dialogflow CX and the Discovery Engine.

3. Discovery Engine Integration:

  • SearchService API: You'll use the Discovery Engine SearchService API (part of the @ google-cloud/discoveryengine library) from within your webhook to send search queries to the chat engine. The SearchService is what you use to query the engine after it's created.
  • Request Format: You'll need to construct a search request that includes the query text and specifies the ID of your chat engine.

You can also refer to the following documents for more details when integrating with Dialogflow CX:

Was this helpful? If so, please accept this answer as “Solution”. If you need additional assistance, reply here within 2 business days and I’ll be happy to help.