Stoobly / stoobly-agent

Record, mock, and test HTTP/HTTPS requests. CLI agent for Stoobly.
Other
6 stars 0 forks source link

orator.exceptions.query.QueryException: Error binding parameter 1 - probably unsupported type. #72

Closed stoobmmelier closed 2 years ago

stoobmmelier commented 2 years ago

Follow up issue to https://github.com/Stoobly/stoobly-agent/issues/67, seeing a similar problem when reading the request. Possibly serialization issue

Traceback (most recent call last):
  File "/home/user/.local/lib/python3.8/site-packages/orator/connections/connection.py", line 32, in _run
    result = wrapped(self, query, bindings, *args, **kwargs)
  File "/home/user/.local/lib/python3.8/site-packages/orator/connections/connection.py", line 209, in select
    cursor.execute(query, bindings)
sqlite3.InterfaceError: Error binding parameter 1 - probably unsupported type.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/user/.local/bin/stoobly-agent", line 8, in <module>
    sys.exit(main())
  File "/usr/lib/python3/dist-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3/dist-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3/dist-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3/dist-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/user/.local/lib/python3.8/site-packages/stoobly_agent/app/cli/scenario_cli.py", line 159, in test
    scenario.test(kwargs['key'], kwargs)
  File "/home/user/.local/lib/python3.8/site-packages/stoobly_agent/app/cli/helpers/scenario_facade.py", line 61, in test
    return self.__replay(scenario_key, {
  File "/home/user/.local/lib/python3.8/site-packages/stoobly_agent/app/cli/helpers/scenario_facade.py", line 74, in __replay
    return replay(scenario_key, replay_options)
  File "/home/user/.local/lib/python3.8/site-packages/stoobly_agent/app/proxy/replay/replay_scenario_service.py", line 21, in <lambda>
    return lambda scenario_key, options: replay(scenario_key, request_model, endpoints_resource, options)
  File "/home/user/.local/lib/python3.8/site-packages/stoobly_agent/app/proxy/replay/replay_scenario_service.py", line 55, in replay
    replay_with_trace(context, trace_context, options)
  File "/home/user/.local/lib/python3.8/site-packages/stoobly_agent/app/proxy/replay/replay_request_service.py", line 33, in replay_with_trace
    return trace_context.with_replay_context(context, lambda context: replay(context, options))
  File "/home/user/.local/lib/python3.8/site-packages/stoobly_agent/app/proxy/replay/trace_context.py", line 77, in with_replay_context
    self.__create_trace_aliases(trace_request, response, endpoint)
  File "/home/user/.local/lib/python3.8/site-packages/stoobly_agent/app/proxy/replay/trace_context.py", line 223, in __create_trace_aliases
    self.create_trace_alias(_alias['name'], value, trace_request) 
  File "/home/user/.local/lib/python3.8/site-packages/stoobly_agent/app/proxy/replay/trace_context.py", line 82, in create_trace_alias
    trace_alias = self.__alias_resolver.create_alias(alias_name, value, trace_request)
  File "/home/user/.local/lib/python3.8/site-packages/stoobly_agent/app/proxy/replay/alias_resolver.py", line 28, in create_alias
    return TraceAlias.first_or_create(
  File "/home/user/.local/lib/python3.8/site-packages/orator/orm/model.py", line 456, in first_or_create
    instance = cls().new_query_without_scopes().where(attributes).first()
  File "/home/user/.local/lib/python3.8/site-packages/orator/orm/builder.py", line 181, in first
    return self.take(1).get(columns).first()
  File "/home/user/.local/lib/python3.8/site-packages/orator/orm/builder.py", line 209, in get
    models = self.get_models(columns)
  File "/home/user/.local/lib/python3.8/site-packages/orator/orm/builder.py", line 455, in get_models
    results = self.apply_scopes().get_query().get(columns).all()
  File "/home/user/.local/lib/python3.8/site-packages/orator/query/builder.py", line 1050, in get
    results = self._processor.process_select(self, self._run_select())
  File "/home/user/.local/lib/python3.8/site-packages/orator/query/builder.py", line 1063, in _run_select
    return self._connection.select(
  File "/home/user/.local/lib/python3.8/site-packages/orator/connections/connection.py", line 34, in _run
    result = self._try_again_if_caused_by_lost_connection(
  File "/home/user/.local/lib/python3.8/site-packages/orator/connections/connection.py", line 357, in _try_again_if_caused_by_lost_connection
    raise QueryException(query, bindings, e)
orator.exceptions.query.QueryException: Error binding parameter 1 - probably unsupported type. (SQL: SELECT * FROM "trace_aliases" WHERE ("name" = ? AND "value" = ? AND "trace_id" = ? AND "trace_request_id" = ?) LIMIT 1 ([':trackAlbum', {'name': 'Love and Paragraphs', 'artists': [{'name': 'Chris Standring', 'id': '1XeMzpgjVKU2dR5xXaZLut', 'uri': 'spotify:artist:1XeMzpgjVKU2dR5xXaZLut', 'href': 'https://api.spotify.com/v1/artists/1XeMzpgjVKU2dR5xXaZLut', 'external_urls': {'spotify': 'https://open.spotify.com/artist/1XeMzpgjVKU2dR5xXaZLut'}}], 'album_group': '', 'album_type': 'album', 'id': '6FQvFmsOaSpmfXFZ2BAJiu', 'uri': 'spotify:album:6FQvFmsOaSpmfXFZ2BAJiu', 'available_markets': ['AD', 'AE', 'AG', 'AL', 'AM', 'AO', 'AR', 'AT', 'AU', 'AZ', 'BA', 'BB', 'BD', 'BE', 'BF', 'BG', 'BH', 'BI', 'BJ', 'BN', 'BO', 'BR', 'BS', 'BT', 'BW', 'BY', 'BZ', 'CA', 'CD', 'CG', 'CH', 'CI', 'CL', 'CM', 'CO', 'CR', 'CV', 'CW', 'CY', 'CZ', 'DE', 'DJ', 'DK', 'DM', 'DO', 'DZ', 'EC', 'EE', 'EG', 'ES', 'FI', 'FJ', 'FM', 'FR', 'GA', 'GB', 'GD', 'GE', 'GH', 'GM', 'GN', 'GQ', 'GR', 'GT', 'GW', 'GY', 'HK', 'HN', 'HR', 'HT', 'HU', 'ID', 'IE', 'IL', 'IN', 'IQ', 'IS', 'IT', 'JM', 'JO', 'JP', 'KE', 'KG', 'KH', 'KI', 'KM', 'KN', 'KR', 'KW', 'KZ', 'LA', 'LB', 'LC', 'LI', 'LK', 'LR', 'LS', 'LT', 'LU', 'LV', 'LY', 'MA', 'MC', 'MD', 'ME', 'MG', 'MH', 'MK', 'ML', 'MN', 'MO', 'MR', 'MT', 'MU', 'MV', 'MW', 'MX', 'MY', 'MZ', 'NA', 'NE', 'NG', 'NI', 'NL', 'NO', 'NP', 'NR', 'NZ', 'OM', 'PA', 'PE', 'PG', 'PH', 'PK', 'PL', 'PS', 'PT', 'PW', 'PY', 'QA', 'RO', 'RS', 'RW', 'SA', 'SB', 'SC', 'SE', 'SG', 'SI', 'SK', 'SL', 'SM', 'SN', 'SR', 'ST', 'SV', 'SZ', 'TD', 'TG', 'TH', 'TJ', 'TL', 'TN', 'TO', 'TR', 'TT', 'TV', 'TW', 'TZ', 'UA', 'UG', 'US', 'UY', 'UZ', 'VC', 'VE', 'VN', 'VU', 'WS', 'XK', 'ZA', 'ZM', 'ZW'], 'href': 'https://api.spotify.com/v1/albums/6FQvFmsOaSpmfXFZ2BAJiu', 'images': [{'height': 640, 'width': 640, 'url': 'https://i.scdn.co/image/ab67616d0000b273b23a68102d5c74e665e005ec'}, {'height': 300, 'width': 300, 'url': 'https://i.scdn.co/image/ab67616d00001e02b23a68102d5c74e665e005ec'}, {'height': 64, 'width': 64, 'url': 'https://i.scdn.co/image/ab67616d00004851b23a68102d5c74e665e005ec'}], 'external_urls': {'spotify': 'https://open.spotify.com/album/6FQvFmsOaSpmfXFZ2BAJiu'}, 'release_date': '2008-01-01', 'release_date_precision': 'day'}, 168, 47]))
stoobmmelier commented 2 years ago

Confirmed #73 fixes this issue