bcgov / entity

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

Namex: error validation incorporation number #13013

Closed severinbeauvais closed 2 years ago

severinbeauvais commented 2 years ago

I have an existing BEN company that I want to rename using a NR.

  1. start with an existing BEN company (eg, BC0871060)
  2. go to Namerequest
  3. create a name to "Change the name of an existing", "British Columbia", "Benefit Company", eg, "Affiliation Test II" (designation: "Inc.")
  4. on final Submission Details page, enter contact info then enter incorporation or registration number, then click Review and Confirm
  5. see error, ie,

image.png

  1. see error in dev console window, ie,

image.png

severinbeauvais commented 2 years ago

@ozamani9 @ozamani9gh FYI

jdyck-fw commented 2 years ago

Eve did some work in this area, connect with her to see what the result of that was.

eve-git commented 2 years ago

captured the error log:

2022-08-09 16:58:18,256 - colin_api - ERROR in app:app.py:1455 - log_exception: Exception on /api/v1/corporations/0702216 [GET]
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1819, in _execute_context
    self.dialect.do_execute(
  File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/default.py", line 732, in do_execute
    cursor.execute(statement, parameters)
psycopg2.errors.UndefinedColumn: column " " does not exist
LINE 1: ...                             THEN cp.first_nme || " "||cp.mi...
                                                             ^

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/opt/app-root/src/colin_api/resources/v1/corporations.py", line 55, in request_colin
    incorp_info_dict, incorp_directors_obj = Methods.init_info(incorp_info_sql, incorp_directors_sql)
  File "/opt/app-root/src/colin_api/resources/v1/corporations.py", line 189, in init_info
    incorp_directors_obj = db.engine.execute(incorp_directors_sql)
  File "<string>", line 2, in execute
  File "/usr/local/lib/python3.10/site-packages/sqlalchemy/util/deprecations.py", line 402, in warned
    return fn(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 3176, in execute
    return connection.execute(statement, *multiparams, **params)
  File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1291, in execute
    return self._exec_driver_sql(
  File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1595, in _exec_driver_sql
    ret = self._execute_context(
  File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1862, in _execute_context
    self._handle_dbapi_exception(
  File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 2043, in _handle_dbapi_exception
    util.raise_(
  File "/usr/local/lib/python3.10/site-packages/sqlalchemy/util/compat.py", line 208, in raise_
    raise exception
  File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1819, in _execute_context
    self.dialect.do_execute(
  File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/default.py", line 732, in do_execute
    cursor.execute(statement, parameters)
sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedColumn) column " " does not exist
LINE 1: ...                             THEN cp.first_nme || " "||cp.mi...
                                                             ^

[SQL: select                     CASE                         WHEN cp.middle_nme IS NOT NULL                             THEN cp.first_nme || " "||cp.middle_nme|| " "||cp.last_nme                         ELSE                             cp.first_nme || " " || cp.last_nme                         END director_name                 from bc_registries.corp_party_vw cp                 where cp.corp_num = '0702216' and cp.end_event_id IS NULL and cp.party_typ_cd = "DIR";]
(Background on this error at: https://sqlalche.me/e/14/f405)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 2077, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 1525, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 1523, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 1509, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
  File "/usr/local/lib/python3.10/site-packages/flask_cors/decorator.py", line 128, in wrapped_function
    resp = make_response(f(*args, **kwargs))
  File "/usr/local/lib/python3.10/site-packages/flask_jwt_oidc/jwt_manager.py", line 272, in decorated
    return f(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/flask_jwt_oidc/jwt_manager.py", line 224, in wrapper
    return f(*args, **kwargs)
  File "/opt/app-root/src/colin_api/resources/v1/corporations.py", line 70, in request_colin
    except exc.SQLAlchemyError as err:  # pylint: disable=undefined-variable # noqa: F821
NameError: name 'exc' is not defined
eve-git commented 2 years ago

The bug has been fixed and deployed to DEV.

jinghualicgi commented 2 years ago

@riyazuddinsyed Please help to verify this ticket, thanks

jinghualicgi commented 2 years ago

@pwei1018 ready for release