apideck-libraries / portman

Port OpenAPI Specs to Postman Collections, inject test suite and run via Newman 👨🏽‍🚀
http://getportman.com/
Apache License 2.0
632 stars 60 forks source link

ERR_INVALID_PROTOCOL - Protocol http not supported, expected https #562

Closed qaribhaider closed 7 months ago

qaribhaider commented 7 months ago

Hello Team 👋

We are facing issues while referencing open api specs from a local url over http (e.g. http://localhost:80/apispecs.json), which ends up generating the following error:

 OAS URL error - There is a problem with the url: "http://localhost:80/apispecs.json"
 TypeError [ERR_INVALID_PROTOCOL]: Protocol "http:" not supported. Expected "https:"

This issue has surfaced in the recent releases e.g. v1.26.3, while this works perfectly fine in earlier version e.g. v1.24.0.

While a local file reference as an alternative is possible, this still affects the use case for synchronisation or doing contract testing for the specs generated on the fly locally. Being able to reference a local url over http would be ideal.

Thank you!

thim81 commented 7 months ago

Can you share a OpenApi example so we can better understand the unexpected behaviour?

qaribhaider commented 7 months ago

I believe the issue is not related to the OpenApi specification file, but rather the protocol it is being served on.

For example, you can use the specs from the example https://github.com/apideck-libraries/portman/blob/main/examples/cli-options/crm.openapi.yml

Then use this specs served from localhost over http: portman -u http://127.0.0.1:8080/crm.openapi.yml -b http://127.0.0.1:8080 -n true

This will produce the protocol error that http is not supported it should be served over https, which seemed to work fine till version v1.24.0

Kindly let me know if you require further details

thim81 commented 7 months ago

hi @qaribhaider

We found the reason for the limitation in the OpenAPI format dependency. We have created a PR for support http & https. It should land soon, which will trigger a version bump for Portman, solving this issue.

qaribhaider commented 7 months ago

@thim81 Thank you, looking forward to this being released

thim81 commented 7 months ago

hi @qaribhaider

We just release v1.26.4 which should handle http & https remote files properly. Let me know if the new version did not solve your issue.

qaribhaider commented 7 months ago

@thim81 Just had a look and it seems to work perfectly fine now, thank you for the support