Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in stack file via api produces no error in api output #3496

Open
alphaDev23 opened this issue Jan 7, 2020 · 7 comments
Open

Error in stack file via api produces no error in api output #3496

alphaDev23 opened this issue Jan 7, 2020 · 7 comments

Comments

@alphaDev23
Copy link

Portainer 1.23.0. An error created by including a space before "version" on the first line produces no error in the api output. Instead, no services are created.

Expected result. An error via the api output should inform the user that the stack file format is incorrect.

@ghost
Copy link

ghost commented Jan 14, 2020

@alphaDev23 I was not able to reproduce this while doing the following api call against the stack creation API 10.1.3.46:9000/api/stacks?endpointId=3&method=string&type=1

body: {
    "Name": "test",
    "SwarmID": "ximybf7av6fmjkffd43n1f4iwp",
    "StackFileContent": " version: '3'\nservices:\n  test:\n    image: nginx",
    "Env": []
}

Could you please elaborate on the api call you are making and provide an example request body you are sending that includes the space before version?

@ghost ghost added the status/need-info label Jan 14, 2020
@alphaDev23
Copy link
Author

alphaDev23 commented Jan 14, 2020

e.g. Stack definition starts with (space before 'version'):

version: '3.4'
services:
...

@ghost
Copy link

ghost commented Jan 16, 2020

@alphaDev23 What are your reproduction steps as I cannot recreate this. Every time I try, the stack is still created.

I have tried:

  • Api call against the stack creation API 10.1.3.46:9000/api/stacks?endpointId=3&method=string&type=1
body: {
    "Name": "test",
    "SwarmID": "ximybf7av6fmjkffd43n1f4iwp",
    "StackFileContent": " version: '3'\nservices:\n  test:\n    image: nginx",
    "Env": []
}
  • Stack creation through the UI with different variations of the YAML:

version: '3.4'
services: 
 test:
   image: nginx
 version: '3.4'
services: 
  test:
    image: nginx

@alphaDev23
Copy link
Author

The api call and the 2nd UI examples you describe are correct. I had produced the error via the api call.

@stale
Copy link

stale bot commented Mar 16, 2020

This issue has been marked as stale as it has not had recent activity, it will be closed if no further activity occurs in the next 7 days. If you believe that it has been incorrectly labelled as stale, leave a comment and the label will be removed.

@stale stale bot added the status/stale label Mar 16, 2020
@stale
Copy link

stale bot commented Mar 23, 2020

Since no further activity has appeared on this issue it will be closed. If you believe that it has been incorrectly closed, leave a comment and mention @itsconquest. One of our staff will then review the issue.
Note - If it is an old bug report, make sure that it is reproduceable in the latest version of Portainer as it may have already been fixed.

@stale stale bot closed this as completed Mar 23, 2020
@ghost
Copy link

ghost commented May 3, 2020

Re-opening this as I have just been able to reproduce this on 1.23.2 in the following ways:

Via UI

  1. Create stack in UI with following yml
 version: '3.4'
services: 
  test:
    image: nginx
  1. See that there is a syntax error shown in the editor but its accepted anyway
    image

  2. See that no services are deployed

Via API

  1. Make API call with space at start of the stack
{
    "Name": "test",
    "SwarmID": "j7zp2f0ly9pl0laf05g6mrlz8",
    "StackFileContent": " version: '3.4'\nservices: \n  test:\n    image: nginx\n",
    "Env": []
}
2. See call succeeds with 200 OK but no services are deployed

@ghost ghost reopened this May 3, 2020
@stale stale bot removed the status/stale label May 3, 2020
chiptus pushed a commit to chiptus/portainer that referenced this issue Aug 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant