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

Issue with swagger-ui (3.24.0) angular (8.2.0) integration #5668

Open
jayanthmay1 opened this issue Oct 21, 2019 · 1 comment
Open

Issue with swagger-ui (3.24.0) angular (8.2.0) integration #5668

jayanthmay1 opened this issue Oct 21, 2019 · 1 comment

Comments

@jayanthmay1
Copy link

Q&A (please complete the following information)

  • OS: Windows
  • Browser: Chrome
  • Version: Version 77.0.3865.120 (Official Build) (32-bit)
  • Method of installation: npm
  • Swagger-UI version: 3.24.0
  • Swagger/OpenAPI version: 8.2.0

###Example Swagger/OpenAPI definition:

###Swagger-UI configuration options:
Followed this link - https://github.com/agoncal/swagger-ui-angular6

Describe the bug you're encountering

_stream_writable.js:57 Uncaught ReferenceError: process is not defined at Object../node_modules/readable-stream/lib/_stream_writable.js (_stream_writable.js:57) at webpack_require (bootstrap:79) at Object../node_modules/readable-stream/readable-browser.js (readable-browser.js:4) at webpack_require (bootstrap:79) at Object../node_modules/stream-browserify/index.js (index.js:28) at webpack_require (bootstrap:79) at Object. (swagger-ui.js:8) at n (swagger-ui.js:1) at Object. (swagger-ui.js:1) at Object. (swagger-ui.js:1)

I believe this issue is related to Polyfills and related to Angular, SwaggerUI versions incompatibility.
I tried with Angular (7.2.0) and SwaggerUI (3.21.0) and it works perfectly fine.
For your reference, here is the link I followed for SwaggerUI (3.21.0) integrate with Angular (7.2.0) https://github.com/agoncal/swagger-ui-angular6

To reproduce...

Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior

It should show the API supplied in a nice swagger-ui view

Screenshots

Additional context or thoughts

@zhutianhe
Copy link

add this code below in polyfills.ts
(window as any).process = { browser: true };
(window as any).global = window;
// @ts-ignore
window.Buffer = window.Buffer || require('buffer').Buffer;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants