TypeError: Cannot read property '0' of undefined
See original GitHub issueHi. We are trying to use the latest master version from the Swagger UI but it appears that something it not working properly in the JS frontend. The UI does not get/parse all the values from the swagger API.
It appears that the response that comes from the endpoint /v2/api-docs is correct. What we can do?
The chrome console shows an error like this:
index.js:24 XHR finished loading: GET "http://xxx:xxx/v2/api-docs".Request.end @ index.js:24SuperagentHttpClient.execute @ schema-markup.js:163SwaggerHttp.execute @ schema-markup.js:24SwaggerClient.build @ resolver.js:291SwaggerClient.initialize @ resolver.js:216module.exports @ resolver.js:165window.SwaggerUi.Backbone.Router.extend.load @ index.js:24window.SwaggerUi.Backbone.Router.extend.updateSwaggerUi @ index.js:24(anonymous function) @ index.js:24f @ backbone-min.js:3e.Events.trigger @ backbone-min.js:3SwaggerUi.Views.HeaderView.Backbone.View.extend.showCustom @ index.js:24r @ lodash.min.js:26p.event.dispatch @ jquery-1.8.0.min.js:2g.handle.h @ jquery-1.8.0.min.js:2
resolver.js:645 Method getMockSignature is deprecated
resolver.js:645 Methods createJSONSample and getSampleValue are deprecated
resolver.js:645 Method getMockSignature is deprecated
... (too many calls like this after...)
resolver.js:645 Methods createJSONSample and getSampleValue are deprecated
index.js:24 Uncaught TypeError: Cannot read property '0' of undefinedSwaggerUi.partials.signature.getInlineModel @ index.js:24SwaggerUi.partials.signature.createParameterJSONSample @ index.js:24SwaggerUi.Views.ParameterView.Backbone.View.extend.render @ index.js:24SwaggerUi.Views.OperationView.Backbone.View.extend.addParameter @ index.js:24SwaggerUi.Views.OperationView.Backbone.View.extend.render @ index.js:24SwaggerUi.Views.ResourceView.Backbone.View.extend.addOperation @ index.js:24SwaggerUi.Views.ResourceView.Backbone.View.extend.render @ index.js:24SwaggerUi.Views.MainView.Backbone.View.extend.addResource @ index.js:24SwaggerUi.Views.MainView.Backbone.View.extend.render @ index.js:24window.SwaggerUi.Backbone.Router.extend.render @ index.js:24options.success @ index.js:24SwaggerClient.buildFromSpec @ resolver.js:497Resolver.finish @ spec-converter.js:99Resolver.resolve @ spec-converter.js:8obj.on.response @ resolver.js:261responseInterceptor @ schema-markup.js:4obj.on.response @ schema-markup.js:8(anonymous function) @ schema-markup.js:220Request.callback @ index.js:24(anonymous function) @ index.js:24Emitter.emit @ index.js:24xhr.onreadystatechange @ index.js:24
Cheers,
Issue Analytics
- State:
- Created 8 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
TypeError: Cannot read Property '0' of Undefined in JS
The "Cannot read property '0' of undefined" error occurs when trying to access the 0th index in a variable that stores an undefined...
Read more >How To Fix Cannot read Property '0' of Undefined in JS
The Solution · Ensure you are using the correct variable · Perform a simple check on your variable before using it to make...
Read more >How to Prevent the Error: Cannot Read Property '0' of Undefined
If a property of an object is an array, it's possible to accidentally misspell the key or try to access the array through...
Read more >Javascript Uncaught TypeError: Cannot read property '0' of ...
The error is here: hasLetter("a",words[]);. You are passing the first item of words , instead of the array. Instead, pass the array to...
Read more >Error: Cannot read property '0' of undefined on macOS · Issue ...
Etcher version: 1.10.6 Operating system and architecture: macOS 10.15.7 Image flashed: steamdeck-recovery-4.img.bz2 What do you think should ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
have the problem too
Same here