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

Vertex AI Search for multi-language sites

Hi Community,  I'm looking for help to install the Vertex AI search for a website project.  Greatly appreciate any input on the below! 

  1. It is a multi-language site,  successfully installed several languages already without issues
  2. Using seperated Datastores for each language  and seperated App setups
  3. Used the clone of a working model,  literally only changed the localised URL in the setup
  4. Integration through out of the box widget,  public access, domain added

Issue:

Trying to setup the US version of the search and receiving an odd error message when query is sent through the widget search bar.  The error is persisting and no results are displayed.

2 Error messages alternating:

[Error] Unhandled Promise Rejection: TypeError: t.replace is not a function. (In 't.replace(/([\/\,\!\\\^\$\{\}\[\]\(\)\.\*\+\?\|\<\>\-\&])/g,"\\$&")', 't.replace' is undefined)
  (anonymous function) (m=bootstrap_module,ucs_widget_module:497:513)

[Error] Unhandled Promise Rejection: TypeError: t.replace is not a function. (In 't.replace(/([\/\,\!\\\^\$\{\}\[\]\(\)\.\*\+\?\|\<\>\-\&])/g,"\\$&")', 't.replace' is undefined)
  Kl (m=bootstrap_module,ucs_widget_module:493:188)
  (anonymous function) (m=bootstrap_module,ucs_widget_module:498)

 

Thank you for your time

 

 

 

1 2 105
2 REPLIES 2

Hello @lallerton1978,

The t.replace is not a function error occurs when the search widget receives invalid input, likely a non-string query or misconfigured language settings. To resolve this, verify the widget’s initialization ensures string-only inputs, confirm the US Datastore is properly linked, and explicitly set languageCode: 'en-US' in the config. Additionally, inspect network requests for malformed API calls and test with hardcoded queries to isolate the issue. If problems persist, compare US settings against working language configurations for discrepancies. 

Some key steps you may try: 

  • Validate that query inputs are strings. 
  • Check Datastore & language settings. 
  • Debug API requests in DevTools. 
  • Test with static queries. 

Best regards,

Suwarna

 

Hi lallerton1978,

Welcome to the Google Cloud Community!

In addition to @SuwarnaKale 's input, this JavaScript error in your Vertex AI Search widget likely means that replace function is being called on something that isn't a string (probably undefined or null). Here are some approaches that might resolve the issue:

  • Verify Data Store: Confirm that the US version of the widget is correctly connected to the appropriate US data store, as this is the most common cause of errors. Additionally, ensure that the data is present in the US data store and properly indexed.
  • Widget Configuration: Ensure the localized URL is correctly updated in the US version’s configuration, the appropriate Search Engine ID is used, and any custom field mappings are accurately configured for the US data store. Double-check for typos.
  • Check Regional Settings: Although you mentioned separate app setups, double-check if there are any regional settings within the Vertex AI Search configuration that might be inadvertently set differently for the US app. 
  • Vertex AI Logs: Look for backend error information in the Google Cloud Console. This can provide more specific details about the error.

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.