-
Notifications
You must be signed in to change notification settings - Fork 336
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
Prism does not start mock locally #2305
Comments
As you said, Prism is broken running under Node.js 18.15.x. % sw_vers -productVersion # Mac OS version
13.4
% nvm install 18.15.0
Downloading and installing node v18.15.0...
Downloading https://nodejs.org/dist/v18.15.0/node-v18.15.0-darwin-x64.tar.xz...
###################################################################################################################################################################################### 100.0%
Computing checksum with sha256sum
Checksums matched!
Now using node v18.15.0 (npm v9.5.0)
% npm install --global @stoplight/prism-cli
...
% prism --version
5.0.1
% prism mock https://raw.githack.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore-expanded.yaml
[9:38:32 AM] › [CLI] … awaiting Starting Prism…
[9:38:32 AM] › [CLI] ✖ fatal Error downloading https://raw.githack.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore-expanded.yaml
The "emitter" argument must be an instance of EventEmitter or EventTarget. Received an instance of AbortSignal
... However, the problem is fixed in 18.16.x. % nvm use 18
Now using node v18.16.1 (npm v9.5.1)
% npm install --global @stoplight/prism-cli
npm WARN deprecated [email protected]: Please switch to @apidevtools/json-schema-ref-parser
...
% prism --version
5.0.1
% prism mock https://raw.githack.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore-expanded.yaml
[9:34:14 AM] › [CLI] … awaiting Starting Prism…
[9:34:15 AM] › [CLI] ℹ info GET http://127.0.0.1:4010/pets
[9:34:15 AM] › [CLI] ℹ info POST http://127.0.0.1:4010/pets
[9:34:15 AM] › [CLI] ℹ info GET http://127.0.0.1:4010/pets/-2232339446628286500
[9:34:15 AM] › [CLI] ℹ info DELETE http://127.0.0.1:4010/pets/-8359716962358653000
[9:34:15 AM] › [CLI] ▶ start Prism is listening on http://127.0.0.1:4010
[9:34:27 AM] › [HTTP SERVER] get /pets ℹ info Request received
[9:34:27 AM] › [NEGOTIATOR] ℹ info Request contains an accept header: */*
[9:34:27 AM] › [VALIDATOR] ✔ success The request passed the validation rules. Looking for the best response
[9:34:27 AM] › [NEGOTIATOR] ✔ success Found a compatible content for */*
[9:34:27 AM] › [NEGOTIATOR] ✔ success Responding with the requested status code 200
[9:34:27 AM] › [NEGOTIATOR] ℹ info > Responding with "200" It looks like the cause is an issue in Node.js's version of undici, as discussed here and fixed in 18.16.x. Although there is a workaround possible for 18.15 I don't think we'll incorporate that into Prism itself. We recommend an upgrade to 18.16.x, and I'll update the documentation to include this caveat for Node.js 18.x in this PR. |
When I try to start mock server locally, I get an error. No matter what src for OpenAPI spec source I use.
Context
It does not start mock server
Current Behavior
The command crashes
Throws an error
Expected Behavior
The mock server starts
Steps to Reproduce
Environment
The text was updated successfully, but these errors were encountered: