dropwizard-swagger
dropwizard-swagger copied to clipboard
Error "Could not render this component, see the console." when clicking the "Try it out" button
Hi, when I press the "Try it out" button I get the error "Could not render this component, see console". I use dropwizard-swagger in version 2.0.12-1.
This is the chrome console output:
TypeError: Cannot read property 'apply' of null at Object.e.requestInterceptor (actions.js:420) at index.js:578 at c (runtime.js:45) at Generator._invoke (runtime.js:271) at Generator.e.
[as next] (runtime.js:97) at o (asyncToGenerator.js:5) at s (asyncToGenerator.js:27) at asyncToGenerator.js:34 at new Promise ( ) at new t (_export.js:36) TypeError: Cannot read property 'get' of null at t.value (live-response.jsx:56) at t.M.t.render (root-injects.jsx:93) at u._renderValidatedComponentWithoutOwnerOrContext (ReactCompositeComponent.js:796) at u._renderValidatedComponent (ReactCompositeComponent.js:819) at u._updateRenderedComponent (ReactCompositeComponent.js:743) at u._performComponentUpdate (ReactCompositeComponent.js:721) at updateComponent (ReactCompositeComponent.js:642) at u.receiveComponent (ReactCompositeComponent.js:544) at Object.receiveComponent (ReactReconciler.js:122) at Object.updateChildren (ReactChildReconciler.js:107)
live-response.jsx line 56:
const url = curlRequest.get("url")
The file live-response.jsx comes from the swagger-ui package (src/core/components)
Does anyone have an idea what I am doing wrong?
Best Regards mahe1970
I think this is probably the same as issue #210
Should be closed as it's a dup of #210 (the other way round actually).
Having the same problem. Tried getting the latest from master but still getting the same error.
So this isn't #210 issue. I've updated swagger and still got this issue. FYI: /swagger-static/index.html requests works fine
We were able to solve this issue by getting the version 2.0.12.2
and removing the lines
<#if customJavascriptPath??>
requestInterceptor: (typeof customRequestInterceptor == 'function' ? customRequestInterceptor : null)
</#if>
from src/main/resources/io/federecio/dropwizard/swagger/index.ftl
Although this fixed our issues, it is not a general solution, as it removes the interceptor for custom javascript.
Having the same problem 4/24/2021. Any new updates?
I’d be happy to review a PR if someone can submit one.
Ok thanks I'l see what I can do
On Sat, Apr 24, 2021, 6:05 PM Justin Plock @.***> wrote:
I’d be happy to review a PR if someone can submit one.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/smoketurner/dropwizard-swagger/issues/206#issuecomment-826122765, or unsubscribe https://github.com/notifications/unsubscribe-auth/AANMFFQFBMKOIAFGEN46K6DTKL26ZANCNFSM4QL7JOWQ .
Hi,
Just following up, it appears only a new release needs to be published to maven central repository as the issue is fixed in code but maven has an older version available.
Thanks, Jason
On Sat, Apr 24, 2021, 7:02 PM Jason Novotny @.***> wrote:
Ok thanks I'l see what I can do
On Sat, Apr 24, 2021, 6:05 PM Justin Plock @.***> wrote:
I’d be happy to review a PR if someone can submit one.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/smoketurner/dropwizard-swagger/issues/206#issuecomment-826122765, or unsubscribe https://github.com/notifications/unsubscribe-auth/AANMFFQFBMKOIAFGEN46K6DTKL26ZANCNFSM4QL7JOWQ .
any updates on this?
Not yet. I got a new machine and haven’t set up the ability to publish to maven central yet
Just want to say I understand and appreciate your maintenance of this library
AN update to this would please our PEN testing team !!!
Any update on this ? This would also be important for us to use the new tag .
Is there a way we can help somehow to create tag and publish to maven central ?
Hi, same need here for an updated version in maven central. Too bad we can't help without the credentials!
For anyone having the experiencing this issue. I found the following workaround:
- Create an "empty" custom request interceptor e.g.
swagger-static/custom-request-interceptor.js
in yourresources
directoryfunction customRequestInterceptor(request) { return request; }
- Add a reference to this file in the
customJavascript
field of theSwaggerBundleConfiguration
class e.g.:
orswagger: customJavascript: "/swagger-static/custom-request-interceptor.js"
bootstrap.addBundle(new SwaggerBundle<>() { protected SwaggerBundleConfiguration getSwaggerBundleConfiguration(ServiceConfiguration configuration) { SwaggerBundleConfiguration config = new SwaggerBundleConfiguration(); config.setCustomJavascript("/swagger-static/custom-request-interceptor.js"); return config; } });
When is the new released planned ?
@amcghie I tried your solution, but the swagger is unable to find the path for the new custom interceptor.
Hi @jplock , @federecio , sorry for bugging you guys directly, but would be nice to have a 2.0.12-2 release with this fix. Could you release it please? It's blocking a lot of us having a more recent version which also allows better dependency management (avoiding CVEs and such). Thank you for your work, pls let us know how we can help you guys!
workaround:
- Copy the fixed
index.ftl
from here to your project resources (and make it land into the jar as well of course) - override the view template in SwaggerBundleConfiguration, where you are adding the bundle to your dw app
SwaggerBundleConfiguration config = new SwaggerBundleConfiguration();
config.getSwaggerViewConfiguration().setTemplateUrl("/index.ftl");
(in my example, I've put the index.ftl
to the root of my jar)
Any movement on this? I have tried some of the work-arounds above, but none of them seem to work for me.
This issue is stale because it has been open 90 days with no activity. Remove the "stale" label or comment or this will be closed in 14 days.
Any updates on this?
config.getSwaggerViewConfiguration().setTemplateUrl("/index.ftl");
Same here :(
This issue is stale because it has been open 90 days with no activity. Remove the "stale" label or comment or this will be closed in 14 days.