SearchBox AutoComplete throws unhandled rejection error

I'm using the searchbox and i'm getting below error for the code below. what am i missing?

Unhandled Rejection (TypeError): Cannot read properties of undefined (reading 'request_id')

(anonymous function)

C:/workspaces/ortho/ORTHO_CLINICAL_GlobalB2BPortal_AZURE_REPO/src/AppSearchAPIConnector.js:171

  168 | this.beforeAutocompleteSuggestionsCall(options, newOptions =>  
  169 |   this.client.querySuggestion(searchTerm, newOptions).then(response => {  
  170 |     autocompletedState.autocompletedSuggestions = response.results;> 
  171 |     autocompletedState.autocompletedSuggestionsRequestId =  
      | ^  
  172 |       response.meta.request_id;  
  173 |   })  
  174 | )
                        <SearchBox
                            autocompleteResults={{titleField: "title",urlField: "nps_link"}}
                            shouldClearFilters={false}
                            autocompleteSuggestions={true}
                            debounceLength={4}
                            autocompleteMinimumCharacters={4}
                            onSubmit={searchTerm => setSearchTerm(searchTerm)}
                            onSelectAutocomplete={(selection, { }, defaultOnSelectAutocomplete) => {
                                if (selection.suggestion) {
                                    setSearchTerm(selection.suggestion);
                                } else {
                                    defaultOnSelectAutocomplete(selection);
                                }
                            }}
                        />

Interesting. Are you able to capture the API request and response using your browser's network inspector?

Hi Jason,
Unfortunately i haven't captured the request and response for this and now i cannot reproduce the issue anymore. Thanks for checking.

Ah ok. Perhaps the front-end code was failing to handle an error response correctly.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.