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

Unable to use swagger UI short code #2017

Closed
6 of 12 tasks
alexandre-touret opened this issue May 27, 2024 · 9 comments
Closed
6 of 12 tasks

Unable to use swagger UI short code #2017

alexandre-touret opened this issue May 27, 2024 · 9 comments
Labels
bug Something isn't working needs-triage

Comments

@alexandre-touret
Copy link

alexandre-touret commented May 27, 2024

Environment

  • Version of Docsy you are using: 0.10.0
  • How are you using Docsy? As a:
    • Hugo module
    • NPM module
    • Git submodule
    • Other:
  • Version of Hugo you are using (output of hugo version): hugo v0.125.6-69ede10edcd539380914bbee58d4d32953dd8b43+extended linux/amd64 BuildDate=2024-05-05T10:52:52Z VendorInfo=gohugoio
  • OS:
    • Linux (Ubuntu 24.04)
    • macOS
    • Windows
    • Other:

Problem

The SwaggerUI shortcode doesn't work anymore.

On my browser's console (I also tested it on several browsers), I have this error:

Uncaught ReferenceError: SwaggerUIBundle is not defined
    onload http://localhost:1313/docs/test-swagger/:227

Then, when I check the network console, I can see the following issues:

image

It seems the URL used (e.g., https://unpkg.com/swagger-ui-dist@5.1.0/swagger-ui.css) to get the JS artifacts are now blocked.

I tested it on a fresh setup of the docsy example.
The JS and CSS are indeed not unpackaged in the public folder.

Here is the way to reproduce this issue:

  • Checkout the docsy example as explained on the documentation (w/ hugo modules)
  • Create the folder my-new-site/content/en/docs/test-swagger
  • Add the following page: _index.md with the following content:
---
title: API Reference
description: TEST
weight: 9
type: swagger
---

{{< swaggerui  src="test.json" >}}
  • Add also a OPENAPI/SWAGGER file besides names test.json

Thanks for your help

@alexandre-touret alexandre-touret added bug Something isn't working needs-triage labels May 27, 2024
@chalin
Copy link
Collaborator

chalin commented May 28, 2024

@theletterf can you take a look?

@theletterf
Copy link
Contributor

@alexandre-touret Some questions:

  • What browser are you using?
  • Was this a Docsy update or you started from scratch?
  • Do you use ad blocker extensions? Anything that might interfere?
  • Can you access the unpkg URLs from the same browser?

@alexandre-touret
Copy link
Author

Hi,

  • I tested it on Edge & Firefox
  • I tested both configurations : an update and I reproduced it on a freshly cloned docsy example (BTW, I used to explain how to reproduce this issue)
  • I just thought about my corporate computer embeds a local proxy/firewall ZScaler
  • I can't access the unpkg URLs from the same browsers

@theletterf
Copy link
Contributor

Oh no, ZScaler is terrible... Could you turn it off temporarily and try again? Or try from a different computer? I cannot reproduce this on my laptop:

Screenshot 2024-05-28 at 11 06 33

@chalin Not sure if we have other external dependencies like this in Docsy. This one might make things difficult for airgapped environments. I could add this as a note to the documentation.

@alexandre-touret
Copy link
Author

Hi,
I will try it on my personal computer.

@theletterf
Copy link
Contributor

@alexandre-touret Any result?

@alexandre-touret
Copy link
Author

Hi,
Unfortunately, I didn't have time yet to test it on another PC.
I'm to do that this weekend

@alexandre-touret
Copy link
Author

Hi
I tested it on my personal computer.

It works ...
It was probably due to my company's security restrictions (ZScaler, ...)

Alexandre

@theletterf
Copy link
Contributor

Thanks @alexandre-touret. Quite an important report, though. I'll add a note to the docs.

theletterf added a commit to theletterf/docsy that referenced this issue Jun 3, 2024
chalin pushed a commit to theletterf/docsy that referenced this issue Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-triage
Projects
None yet
Development

No branches or pull requests

3 participants