prism icon indicating copy to clipboard operation
prism copied to clipboard

proxy Error TypeError: Only HTTP(S) protocols are supported

Open ale-sanchez-g opened this issue 3 years ago • 6 comments

Issue: I am getting an Error TypeError: Only HTTP(S) protocols are supported on the Proxy function for https://supervillain.herokuapp.com/api-docs/ for all the calls.

Instead, when I run the mock version, the API calls are working as expected.

I am currently running the below:

Prism version 4.10.1 node version 17.5.0 Spec https://raw.githubusercontent.com/ale-sanchez-g/villain/master/app/swagger/openapi.json Node server running on express https://github.com/ale-sanchez-g/villain

Example call:

curl --location --request POST 'http://127.0.0.1:4010/auth/gentoken' \
--header 'Authorization: test' \
--header 'Content-Type: application/json' \
--data-raw '{
    "key": "brp64nlh",
    "email": "[email protected]"
}'

Example response:

{
    "type": "TypeError",
    "title": "Only HTTP(S) protocols are supported",
    "status": 500,
    "detail": ""
}

ale-sanchez-g avatar Jul 18 '22 06:07 ale-sanchez-g

hey @ale-sanchez-g - thanks for the issue. can you please share how you are setting up the proxy? if the cli, the full list of arguments would be great.

daniel-white avatar Jul 18 '22 14:07 daniel-white

@ale-sanchez-g : I got this error when I started my prism thus: prism proxy my-api.yaml localhost:8000 --errors

Fixed when I changed to prism proxy my-api.yaml http://localhost:8000 --errors

ikenna avatar Jul 19 '22 03:07 ikenna

we could take this as an enhancement request to return an appropriate error message when running the cli

daniel-white avatar Jul 19 '22 14:07 daniel-white

hey @ale-sanchez-g - thanks for the issue. can you please share how you are setting up the proxy? if the cli, the full list of arguments would be great.

The cli arguments are as per the documentation after I followed @ikenna suggestion the proxy is working.

prism proxy app/swagger/openapi.json localhost:3000 --errors

ale-sanchez-g avatar Jul 24 '22 11:07 ale-sanchez-g

The documentation has been updated. https://meta.stoplight.io/docs/prism/72d69fb629de0-validation-proxy

pamgoodrich avatar Jul 25 '22 14:07 pamgoodrich

fantastic this is working perfectly now

ale-sanchez-g avatar Aug 02 '22 06:08 ale-sanchez-g