Skip to content

Prism does not start mock locally #2305

Closed
@SamJust

Description

@SamJust

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

[3:34:15 PM] › [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
prism mock <document>

Start a mock server with the given document file

Positionals:
  document  Path to a document file. Can be both a file or a fetchable resource
            on the web.                                      [string] [required]

Options:
      --version       Show version number                              [boolean]
      --help          Show help                                        [boolean]
  -p, --port          Port that Prism will run on.
                                             [number] [required] [default: 4010]
  -h, --host          Host that Prism will listen to.
                                      [string] [required] [default: "127.0.0.1"]
      --cors          Enables CORS headers.            [boolean] [default: true]
  -m, --multiprocess  Forks the http server from the CLI for faster log
                      processing.                     [boolean] [default: false]
      --errors        Specifies whether request/response violations marked as
                      errors will produce an error response
                                           [boolean] [required] [default: false]
  -v, --verboseLevel  Turns on verbose logging.
        [required] [choices: "trace", "debug", "info", "warn", "error", "fatal",
                                                     "silent"] [default: "info"]
  -d, --dynamic       Dynamically generate examples.  [boolean] [default: false]

{
  stack: 'ResolverError: Error downloading https://raw.githack.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore-expanded.yaml \n' +
    'The "emitter" argument must be an instance of EventEmitter or EventTarget. Received an instance of AbortSignal\n' +
    '    at download (/Users/viktorbezrdonyi/.nvm/versions/node/v18.15.0/lib/node_modules/@stoplight/prism-cli/node_modules/@stoplight/json-schema-ref-parser/lib/resolvers/http.js:175:11)\n' +
    '    at processTicksAndRejections (node:internal/process/task_queues:95:5)',
  code: 'ERESOLVER',
  message: 'Error downloading https://raw.githack.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore-expanded.yaml \n' +
    'The "emitter" argument must be an instance of EventEmitter or EventTarget. Received an instance of AbortSignal',
  source: 'https://raw.githack.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore-expanded.yaml',
  path: null,
  toJSON: [Function: toJSON],
  ioErrorCode: 'ERR_INVALID_ARG_TYPE',
  name: 'ResolverError',
  toString: [Function: toString]
}

Expected Behavior

The mock server starts

Steps to Reproduce

  1. $ npm i -g @stoplight/prism-cli
  2. $ prism mock https://raw.githack.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore-expanded.yaml

Environment

  • Version used: 5.0.1
  • Environment name and version: Node v18.15.0
  • Operating System and version: MacOS: 13.2.1 (22D68)
  • Link to your environment/workspace/project: It's a single CLI call.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions