optic diff --web does not open browser when run in WSL - does not display URL to manually open.
I'm using Optic inside WSL, and when using the optic diff --web command it (expectedly) fails to open anything as WSL is a headless environment.
As a fix/workaround, please display the URL to open directly.
We'll look into using a better cross platform URL opener. I think I've seen one in the past that works with whatever browser is in the registry.
Showing the URL is less useful than it may seem -- most of the browsers have a limit of the length of a URL, and even a modestly OpenAPI file (hundreds lines) surpasses it. For whatever reason those limits are not applied if you don't manually paste the URL into the address bar. However -- if it won't do either -- not useful. We'll look into this as a bug
Faced with the same issue. Any updates or ETA? IMO, showing URL would be useful for debug purpose as well as using URL as link in the docs.
Hey @alexandre-orca -- we are still trying to figure out a good approach here. Unfortunately when we print the URL it's often too long for browsers to accept.
What version of WSL are you using? The library we use says it supports most WSL opens https://www.npmjs.com/package/open?activeTab=readme
@acunniffe We are using Linux build machines so there no browser at all. Maybe you somehow can add saving request in some format (like cURL, maybe using this).
Hey @alexandre-orca -- we recently added optic diff ... --web --upload which supports saving changelogs to your Optic Cloud account. This makes them easier to share / persist. We've still yet to find a good way to get this to open in every browser.
We may one day support a local server that renders the diff, but it hasn't been a priority right now and we're a small team. Will that option work for you?
Just wanted to add a bit more of an explanation of what's happening here
When you run optic diff --web, we open the URL app.useoptic.com/cli/diff#your-data - we encoded all the data in the hash so nothing needs to be uploaded to our servers. This does mean the hash can be very long (100k characters long), and needs to be directly opened (i.e. it cannot be copy pasted since most browsers have a soft limit that they can open, and this url will take the entire output of the terminal)
The alternative, is what @acunniffe posted above, where you can set --upload --web. This will upload the diff results to Optic which you can then view directly (will output a URL something like https://app.useoptic.com/organizations/your-org/apis/your-api/runs/your-run)
Going to close this out for now - if there's anything else feel free to open another issue - thanks!