[solved] Slash command failed

Summary

I have an issue with a slash command.When I try my custom command I have this error:

Command with a trigger of ‘post’ failed

Steps to reproduce

My mattermost server is running on windows in a docker and is configured on http://127.0.0.1:8065
I set the site url to: http://127.0.0.1:8065
I added a slash command with this config:
Request URL : http://127.0.0.1:5000/post
Request Method: POST

I also have a flask server running on http://127.0.0.1:5000/ which has one route

@app.route('/post', methods=['POST', 'GET'])
def post():
    data = request.form
    print(data)

I added
"EnableInsecureOutgoingConnections": true,
"AllowedUntrustedInternalConnections": "localhost",
to config.json, default.json and config-docker.json

Expected behavior

When I try /post in the defaukt Town Square channel I get Command with a trigger of ‘post’ failed

detailed_error: ""
id: "api.command.execute_command.failed.app_error"
message: "Command with a trigger of 'post' failed"
request_id: "a5n1xkch77g9zb9u6a61456age"
status_code: 500

Do you have an idea to solve this ?

Hi @gloupmer,

Is that flask app running inside the Mattermost Docker container? (If that’s not the case, then Mattermost’s 127.0.0.1 != flask’s 127.0.0.1 . In other words, Mattermost won’t be able to reach the flask app.)

When I try with the flask server in the container, I can’t access the server on 127.0.0.1:5000
I added the port 5000 to the container

CONTAINER ID        IMAGE                           COMMAND                  CREATED             STATUS              PORTS                                                                                         NAMES
1379bc206848        mattermost/mattermost-preview   "/bin/sh -c ./docker…"   17 minutes ago      Up About a minute   0.0.0.0:5000->5000/tcp, 0.0.0.0:8065->8065/tcp, 3306/tcp, 33060/tcp, 0.0.0.0:8069->8069/tcp   preview

I fixed that issue but still have the command failed

Hi @gloupmer, Would you be open to joining our Peer-to-Peer Help channel on our community server for more help on this issue?

I’m not sure what the solution is and I haven’t received feedback from our team in the past few days on this yet.

I fixed this by changing docker config

1 Like