postmanlabs / postman-app-support

Postman is an API platform for building and using APIs. Postman simplifies each step of the API lifecycle and streamlines collaboration so you can create better APIs—faster.
https://www.postman.com
5.85k stars 839 forks source link

Cannot publish API via Desktop client or Postman CLI #12577

Open mkurapov opened 10 months ago

mkurapov commented 10 months ago

Is there an existing issue for this?

Describe the Issue

In our repo, https://github.com/interledger/rafiki we publish a new API version from a collections file using the Postman CLI whenever there are changes to the collection via the Git integration.

However, recently, publishing APIs has started to fail, both from the CLI and in the desktop client with no descriptive error.

The CLI:

max ~/interledger/rafiki [main] $ postman api publish 84fc90ca-3153-4865-8b49-b91218e5d574  --name main --release-notes "APIs corresponding to Rafiki main branch" --collections "postman/collections/Interledger.json"
Branch found: main

Successfully triggered publish for API: 84fc90ca-3153-4865-8b49-b91218e5d574

Publish in progress...
Checking again in 5sec...

Publish in progress...
Checking again in 10sec...

Publish in progress...
Checking again in 15sec...

Publish in progress...
Checking again in 20sec...

Publish in progress...
Checking again in 25sec...
⠓ Checking status of the published version

Error: Publishing the API Version failed.
For more information visit: https://go.pstmn.io/postman-cli-faq

The Postman client (seemingly works, then selecting the newly published API version hangs on "Setting up API version", and then gets removed):

https://github.com/postmanlabs/postman-app-support/assets/15069181/0b7827c6-34cc-4c22-8aa5-8da1e6832c15

This is the file to the collection, and the folder of the autogenerated Postman config.

Questions:

Steps To Reproduce

  1. Call the postman api publish command from repo

Screenshots or Videos

No response

Operating System

macOS

Postman Version

10.21.14

Postman Platform

Postman App

User Account Type

Signed In User

Additional Context?

No response

jatin3893 commented 10 months ago

@mkurapov I saw the linked PR from your repository and your observation is correct:

the collection file, Interledger.json was exported and updated manually instead of via the Postman Git integration. It looks like each request needs an id to properly publish the API.

Manually editing the collection file and changing the IDs can create inconsistencies and impact the API's linked collection. Hence the publish flow fails internally and hence it disappears after some time.

We have internally noted your feedback that the errors should be more descriptive so that a user can fix these things by themselves or make it easier to fix from the Postman client itself.


Just for my understanding, how was the Collection file "updated manually"? Was the raw JSON edited directly or was it copy pasted from somewhere else?

I also noticed that you were able to publish the API correctly after the revert changes. So do you need any additional help with it?

mkurapov commented 10 months ago

Thanks for the response @jatin3893

Manually editing the collection file and changing the IDs can create inconsistencies and impact the API's linked collection. Hence the publish flow fails internally and hence it disappears after some time.

That makes sense. However, the very first thing I tried was just to go through each request and hit Save on it in the Postman client. This properly added ids to all of the requests, scripts, and tests: https://github.com/interledger/rafiki/blob/7dfbda49ded1b48eb1cd22a9dc97cb12c43b8bb0/postman/collections/Interledger.json Even though the files looks fine with the correct IDs (on the given branch), I was unable to publish the API still, with the same command:

postman api publish 84fc90ca-3153-4865-8b49-b91218e5d574  --name 1949/mk/fix-publish --release-notes "APIs corresponding to Rafiki main branch" --collections "postman/collections/Interledger.json"
Branch found: 1949/mk/fix-publish
⠙ Publishing API to Postman

Error: Something went wrong while fetching contents to publish
For more information visit: https://go.pstmn.io/postman-cli-faq

How are the IDs assigned and linked in Postman? That would help with my understanding.

Just for my understanding, how was the Collection file "updated manually"?

I think the collection was exported manually from the desktop client and then just directly replaced the existing Interledger.json file.

I also noticed that you were able to publish the API correctly after the revert changes. So do you need any additional help with it? We use a Github Action to publish the API automatically, and it looks like it ended up working on a retry: https://github.com/interledger/rafiki/actions/runs/7492386229/job/20395757461 (failed) https://github.com/interledger/rafiki/actions/runs/7492386229/job/20395914333 (succeeded)

I'm not sure why the original ended up failing, but it was the same behaviour for me locally: worked on the second attempt. Is there a way that I can see debug logs as to why it fails sporadically?