Skip to content

Server error on update api related to updating tags #1

@seanmcfeely

Description

@seanmcfeely

Trying to update an existing indicators tags caused the server to have an error.

removing tag from indicator: whitelist:e2w
2019-12-10 16:11:38,977 - root - [WARNING] Empty list is not handled by SIP API. Will cause schema: [] is too short. Putting in 'sipit-exception-tag:remove me'
updating status of 212946 to Informational
{'tags': ['sipit-exception-tag:remove-me'], 'status': 'Informational'}
Traceback (most recent call last):
  File "./sipit.py", line 261, in <module>
    results = sip_client.put('/api/indicators/{}'.format(args.id),data)
  File "/usr/local/lib/python3.6/dist-packages/pysip/pysip.py", line 142, in put
    raise RequestError(request.text)
pysip.pysip.RequestError: {"error":"Internal Server Error","msg":"Internal server error"}

Exception from SIP Server logs:

[2019-12-10 21:12:25,865] ERROR in app: Exception on /api/indicators/212946 [PUT]
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2311, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1834, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1737, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python3.7/site-packages/flask/_compat.py", line 36, in reraise
    raise value
  File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1832, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1818, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/usr/src/app/project/api/decorators.py", line 74, in decorated_function
    return function(*args, **kwargs)
  File "/usr/src/app/project/api/decorators.py", line 136, in decorated_function
    return function(*args, **kwargs)
  File "/usr/src/app/project/api/decorators.py", line 154, in decorated_function
    return function(*args, **kwargs)
  File "/usr/src/app/project/api/routes/indicator.py", line 1405, in update_indicator
    db.session.commit()
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/scoping.py", line 162, in do
    return getattr(self.registry(), name)(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/session.py", line 1026, in commit
    self.transaction.commit()
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/session.py", line 493, in commit
    self._prepare_impl()
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/session.py", line 472, in _prepare_impl
    self.session.flush()
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/session.py", line 2458, in flush
    self._flush(objects)
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/session.py", line 2596, in _flush
    transaction.rollback(_capture_exception=True)
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/util/langhelpers.py", line 68, in __exit__
    compat.reraise(exc_type, exc_value, exc_tb)
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 129, in reraise
    raise value
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/session.py", line 2556, in _flush
    flush_context.execute()
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/unitofwork.py", line 422, in execute
    rec.execute(self)
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/unitofwork.py", line 540, in execute
    self.dependency_processor.process_saves(uow, states)
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/dependency.py", line 1124, in process_saves
    state, child, associationrow, False, uowcommit, "add"
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/dependency.py", line 1239, in _synchronize
    self._verify_canload(child)
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/dependency.py", line 253, in _verify_canload
    "collection %s" % (self.prop,)
sqlalchemy.orm.exc.FlushError: Can't flush None value found in collection Indicator.tags

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions