8000 recorder component can not deal with event names > 32 chars · Issue #38917 · home-assistant/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
8000
recorder component can not deal with event names > 32 chars #38917
Closed
@thomasdelaet

Description

@thomasdelaet

The problem

The recorder component cannot deal with events that are longer than 32 characters. Although events fire successfully using the frontend developer console, the recorder component throws errors.

Environment

  • Home Assistant Core release with the issue: 0.114.0
  • Last working Home Assistant Core release (if known): N/A
  • Operating environment (OS/Container/Supervised/Core): Core
  • Integration causing this issue: recorder with PostgreSQL but I assume it's not linked to this DB.
  • Link to integration documentation on our website:

Problem-relevant configuration.yaml

recorder:
    db_url: !secret recorder_url
    purge_keep_days: 7

Traceback/Error logs

2020-08-15 22:24:38 ERROR (Recorder) [homeassistant.components.recorder] Error adding event: This Session's transaction has been rolled back due to a previous exception during flush. To begin a new transaction with this Session, first issue Session.rollback(). Original exception was: (psycopg2.errors.StringDataRightTruncation) value too long for type character varying(32)

[SQL: INSERT INTO events (event_type, event_data, origin, time_fired, created, context_id, context_user_id, context_parent_id) VALUES (%(event_type)s, %(event_data)s, %(origin)s, %(time_fired)s, %(created)s, %(context_id)s, %(context_user_id)s, %(context_parent_id)s) RETURNING events.event_id]
[parameters: {'event_type': 'event_that_is_longer_than_thirtytwo_char', 'event_data': '{}', 'origin': 'REMOTE', 'time_fired': datetime.datetime(2020, 8, 15, 20, 24, 38, 432948, tzinfo=<UTC>), 'created': datetime.datetime(2020, 8, 15, 20, 24, 38, 434206, tzinfo=<UTC>), 'context_id': '579c15d1df3511eabe12edaf385ce687', 'context_user_id': '1cf78414233e4f588a4d66a0575bc7a9', 'context_parent_id': None}]
(Background on this error at: http://sqlalche.me/e/13/9h9h) (Background on this error at: http://sqlalche.me/e/13/7s2a)
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/components/recorder/__init__.py", line 377, in run
    self.event_session.flush()
  File "/srv/homeassistant/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 2523, in flush
    self._flush(objects)
  File "/srv/homeassistant/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 2618, in _flush
    flush_context.transaction = transaction = self.begin(
  File "/srv/homeassistant/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 953, in begin
    self.transaction = self.transaction._begin(nested=nested)
  File "/srv/homeassistant/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 317, in _begin
    self._assert_active()
  File "/srv/homeassistant/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 289, in _assert_active
    raise sa_exc.InvalidRequestError(
sqlalchemy.exc.InvalidRequestError: This Session's transaction has been rolled back due to a previous exception during flush. To begin a new transaction with this Session, first issue Session.rollback(). Original exception was: (psycopg2.errors.StringDataRightTruncation) value too long for type character varying(32)

[SQL: INSERT INTO events (event_type, event_data, origin, time_fired, created, context_id, context_user_id, context_parent_id) VALUES (%(event_type)s, %(event_data)s, %(origin)s, %(time_fired)s, %(created)s, %(context_id)s, %(context_user_id)s, %(context_parent_id)s) RETURNING events.event_id]
[parameters: {'event_type': 'event_that_is_longer_than_thirtytwo_char', 'event_data': '{}', 'origin': 'REMOTE', 'time_fired': datetime.datetime(2020, 8, 15, 20, 24, 38, 432948, tzinfo=<UTC>), 'created': datetime.datetime(2020, 8, 15, 20, 24, 38, 434206, tzinfo=<UTC>), 'context_id': '579c15d1df3511eabe12edaf385ce687', 'context_user_id': '1cf78414233e4f588a4d66a0575bc7a9', 'context_parent_id': None}]
(Background on this error at: http://sqlalche.me/e/13/9h9h) (Background on this error at: http://sqlalche.me/e/13/7s2a)
2020-08-15 22:24:38 ERROR (Recorder) [homeassistant.components.recorder] Error adding event: This Session's transaction has been rolled back due to a previous exception during flush. To begin a new transaction with this Session, first issue Session.rollback(). Original exception was: (psycopg2.errors.StringDataRightTruncation) value too long for type character varying(32)

Additional information

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0