Skip to content

Creating executions fails due to unserializible date (running from sources) #4908

@winem

Description

@winem

SUMMARY

I followed these docs: https://docs.stackstorm.com/development/sources.html

Whenever I try to trigger an action st2 / the API I get the following error:

st2 run core.local uname
ERROR: 500 Server Error: Internal Server Error
MESSAGE: datetime.datetime(2020, 4, 13, 23, 9, 54, 712681, tzinfo=tzutc()) is not JSON serializable for url: http://127.0.0.1:9101/v1/executions

STACKSTORM VERSION

st2 3.2dev, on Python 3.6.9

I'm currently at this commit: f5e56ac

OS, environment, install method
uname -a 
Linux ITS0873 5.3.0-46-generic #38~18.04.1-Ubuntu SMP Tue Mar 31 04:17:56 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
# with activated virtualenv
python -V
Python 3.6.9
virtualenv --version
virtualenv 20.0.16 from /home/marcel/.local/lib/python3.6/site-packages/virtualenv/__init__.py

(It's the same with Python2.7 and the default virtual env. I just tried both to be sure.)

These are the used backends running in docker containers with the env files as being provided with the st2-docker project:

rabbitmq:3.6-management
mongo:3.4
redis:4.0
postgres:9.6

Steps to reproduce the problem

The steps from the docs up to Verify Installation. st2 action list works fine.
https://docs.stackstorm.com/development/sources.html

Expected Results

Expected to have a newly created execution.

Actual Results

The corresponding curl call gives some more output. The interesting part:

curl -X POST -H  'User-Agent: python-requests/2.23.0' -H  'Accept-Encoding: gzip, deflate' -H  'Accept: */*' -H  'Connection: keep-alive' -H  'content-type: application/json' -H  'Content-Length: 70' --data-binary '{"action": "core.local", "parameters": {"cmd": "uname"}, "user": null}' http://127.0.0.1:9101/v1/executions

# -------- begin 139695680141744 response ----------
{
    "faultstring": "datetime.datetime(2020, 4, 13, 23, 12, 56, 492255, tzinfo=tzutc()) is not JSON serializable"
}
# -------- end 139695680141744 response ------------

ERROR: 500 Server Error: Internal Server Error
MESSAGE: datetime.datetime(2020, 4, 13, 23, 12, 56, 492255, tzinfo=tzutc()) is not JSON serializable for url: http://127.0.0.1:9101/v1/executions

CLI settings:
----------------
Config file path: /home/marcel/.st2/config
Client settings:
----------------
ST2_BASE_URL: http://127.0.0.1
ST2_AUTH_URL: http://127.0.0.1:9100
ST2_API_URL: http://127.0.0.1:9101/v1
ST2_STREAM_URL: http://127.0.0.1:9102/v1
ST2_AUTH_TOKEN: None

Proxy settings:
---------------
HTTP_PROXY: 
HTTPS_PROXY: 

Traceback (most recent call last):
  File "/home/marcel/Sources/gitlab.winem/st2/st2client/st2client/shell.py", line 407, in run
    func(args)
  File "/home/marcel/Sources/gitlab.winem/st2/st2client/st2client/commands/resource.py", line 47, in decorate
    return func(*args, **kwargs)
  File "/home/marcel/Sources/gitlab.winem/st2/st2client/st2client/commands/action.py", line 263, in run_and_print
    execution = self.run(args, **kwargs)
  File "/home/marcel/Sources/gitlab.winem/st2/st2client/st2client/commands/resource.py", line 47, in decorate
    return func(*args, **kwargs)
  File "/home/marcel/Sources/gitlab.winem/st2/st2client/st2client/commands/action.py", line 1015, in run
    execution = action_exec_mgr.create(execution, **kwargs)
  File "/home/marcel/Sources/gitlab.winem/st2/st2client/st2client/models/core.py", line 41, in decorate
    return func(*args, **kwargs)
  File "/home/marcel/Sources/gitlab.winem/st2/st2client/st2client/models/core.py", line 307, in create
    self.handle_error(response)
  File "/home/marcel/Sources/gitlab.winem/st2/st2client/st2client/models/core.py", line 167, in handle_error
    response.raise_for_status()
  File "/home/marcel/Sources/gitlab.winem/st2/venv3.6/lib/python3.6/site-packages/requests/models.py", line 941, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 500 Server Error: Internal Server Error
MESSAGE: datetime.datetime(2020, 4, 13, 23, 12, 56, 492255, tzinfo=tzutc()) is not JSON serializable for url: http://127.0.0.1:9101/v1/executions

Let me know if anything else is needed.

Thanks in advance!

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