REST API documentation via Swagger not loading

pnolan's Avatar

pnolan

12 Jan, 2018 04:57 AM

Hi,

In the Octopus documentation (see link below) it states

"As of 3.17, Octopus now includes the default Swagger UI for displaying the API documentaiton in a nice human readable way. To browse that UI just open your browser and go to [OctopusServerURL]/swaggerui/"

However, I get a Failed to load spec error (screenshot attached). It looks like a CSP related error.

I also see the following error message

// 20180112145957 // https://online.swagger.io/validator/debug?url=http://prdbuild/api/s...

{ "schemaValidationMessages": [ { "level": "error", "message": "Can't read from file http://prdbuild/api/swagger.json" } ] }

Is there anything extra I need to do to get Swagger working?

https://octopus.com/docs/api-and-integration/api

  1. Support Staff 1 Posted by Alex Rolley on 15 Jan, 2018 03:06 AM

    Alex Rolley's Avatar

    Hi,

    Thanks for getting in touch!

    I've attempted to replicate the error on our end and haven't been able to as yet (using 4.1.5 and 4.1.8). Are you able to let me know which version of Octopus that you are using?

    The CSP error that you are seeing appears to be local to the environment that you are in (potentially you don't have access to Gravatar), are you able to confirm with your security/networking teams?

    I look forward to hearing from you shortly,

    Alex

  2. 2 Posted by Nick McElheny on 16 Jan, 2018 07:13 PM

    Nick McElheny's Avatar

    We were seeing this same CSP error in our environment when accessing the Swagger UI due to us utilizing a virtual directory as part of our Octopus path. This sounds very similar to what we encountered and if it's the same issue then it is fixed in v4.1.9+:
    https://github.com/OctopusDeploy/Issues/issues/4072

    Nick

  3. 3 Posted by pnolan on 08 Feb, 2018 10:21 PM

    pnolan's Avatar

    Hi Nick,

    I just tested Swagger again and it now seems to load ok.

    We're currently on V2018.1.3 so perhaps the issue was resolved in a patch upgrade as was suggested above by Nick McElheny.

    However, when I execute an operation via swagger it fails (see attached screenshot). This is reason is as follows

    1. Octopus is located at http://prdbuild/octopus
    2. Swagger access via http://prdbuild/octopus/swaggerui/index.html
    3. When executing Get /api/users/me the Swagger Curl statement is "curl -X GET "http://prdbuild/api/users/me..."

    This indicates that Swagger is not constructing the correct url. The API is located at http://prdbuild/octopus/api/ and not http://prdbuild/api/

    Is this an issue with Swagger or am I doing something wrong?

    Thanks heaps for your help!

  4. 4 Posted by pnolan on 12 Feb, 2018 11:10 PM

    pnolan's Avatar

    Hi Nick just thought I would touch base to see if you have been able to consider this issue?

  5. 5 Posted by Nick McElheny on 14 Feb, 2018 01:18 PM

    Nick McElheny's Avatar

    Hi pnolan,

    I'm just an Octo customer and so someone like Alex might need to weigh in on this issue. I can confirm that we're seeing the same behavior in our environment in v2018.2.2 when using a virtual directory. If we take off the virtual directory, the path constructs as expected.

    Nick

  6. Support Staff 6 Posted by Alex Rolley on 16 Feb, 2018 05:01 AM

    Alex Rolley's Avatar

    Hi,

    Sorry for the slow response on this one, been quite busy unfortunately :(

    I have been able to replicate the issue and have raised a GitHub issue #4291.

    Feel free to follow the issue so that you are notified when it is resolved. Apologies for the inconvenience.

    Regards,
    Alex

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Already uploaded files

  • OctopusSwaggerUI.png 33.4 KB

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac