bcgov / entity

ServiceBC Registry Team working on Legal Entities
Apache License 2.0
23 stars 59 forks source link

Business Look up is taking in spaces as characters in the search leading the API to fail with a 500 internal server error. #24631

Open riyazuddinsyed opened 4 days ago

riyazuddinsyed commented 4 days ago

Describe the bug in the current situation When a user enters extra spaces in the business lookup search, the Business Search API fails and returns a 500 Internal Server Error. This issue does not occur when special characters or other inputs are entered, suggesting that the presence of extra spaces is causing an unexpected failure in the backend.

Steps to reproduce the behavior:

  1. Go to 'test.account.bcregistry.gov.bc.ca'
  2. In the business Look up enter 3 spaces
  3. Now in the network call notice that the businesses search API fails with a 500 internal server error.

Screenshots/ Visual Reference/ Source

Screen Shot 2024-11-27 at 3.43.32 PM.png
severinbeauvais commented 3 days ago

It was observed that searching using 3 invalid characters (like "$$$") gets passed to Business Search and does not result in an HTTP 500.

It could be argued that the UI should filter out spaces, but it doesn't filter out other invalid characters. Also, the API should protect itself from invalid search parameters instead of crashing with a SOLR error.

@mstanton1 If search function isn't managed by BTR Team, please re-assign. Thanks.

mstanton1 commented 3 days ago

@severinbeauvais the search API is managed by the BTR team. A key question is whether we should be stripping any characters. An organizational goal is to move towards support for indigenous and French characters. With the BTR filing we've allowed all ascii characters for significant individuals which may be a way to proceed with companies as well. My understanding of the historical reason we didn't allow dollar signs in names was because there was a mainframe limitation. When search work is picked up again next PI we can look at this further.

severinbeauvais commented 3 days ago

So there's a discrepancy: the Search API does not crash if the UI requests a search for "$$$", but it does crash if the UI requests a search for " " (3 spaces).

mstanton1 commented 3 days ago

Thanks for the clarity. I will connect with Kial next PI on this one, unless we find a number of ops tickets coming in as a result which would warrant finding another resource to tackle this sooner.