Postman ошибка 500

Postman API PUT to collections endpoint gives 500 and 504 and sometimes returns an empty body. We update the collections to 25 users from the ci run in wercker which runs 10 updates concurrently. S...

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement. We’ll occasionally send you account related emails.

Already on GitHub?
Sign in
to your account


Open

Bysmyyr opened this issue

Mar 21, 2020

· 24 comments


Open

Postman api returns 500 and 504

#8213

Bysmyyr opened this issue

Mar 21, 2020

· 24 comments

Assignees

@davidespihernandez

Comments

@Bysmyyr

Postman API PUT to collections endpoint gives 500 and 504 and sometimes returns an empty body. We update the collections to 25 users from the ci run in wercker which runs 10 updates concurrently. Sometimes all they go through fine, sometimes there is one or two fail which is covered by retry logic but increasingly lately it fails so badly than 10 retries are not enough. Collections are quite big, about 600 requests altogether. It also generates double collections(some empty, some not).

500 {"error":{"name":"serverError","message":"Something went wrong with the server."}}

504:

<html>
<head><title>504 Gateway Time-out</title></head>
<body bgcolor="white">
<center><h1>504 Gateway Time-out</h1></center>
<hr><center>nginx</center>
</body>
</html>

@preethammavin

@Bysmyyr can you write to us at help@getpostman.com. Would want to take a deeper look at this, I would suggest breaking the collection down into smaller collections of size (preferably lesser than 25 MB) as I see it is timeout error there.

@abiancu

Trying to make a GET request to https://api.covid19api.com/summary but getting a 504 error. Was working fine on 05/02/2020

<title>504 Gateway Time-out</title>

504 Gateway Time-out


nginx/1.14.0 (Ubuntu)

@Bysmyyr

@abiancu Your error is not even closely related to this. This is about postman internal API, not using poistman for some other API

@mohitranka

@Bysmyyr — We have made few performance improvements to these endpoints in the last month. I’d like to know if you are still facing issues around big collection updates.

@galbarm

@mohitranka
I’m still facing the issue.
You can see more details in support ticket #60411

Specifically, for update collection request with body around 1MB, the «Something went wrong with the server.» error is returned after 1 minute.

Also note that collections API only operates on full collections.
You cannot update a single request/folder within a collection.
As a result, there is no workaround for this issue.

@Bysmyyr

@mohitranka Thanks for your reply. Our issues have went worse in last months.

@Raj-postman

Our team checked on this further after the comment @Bysmyyr — may I know if it helped?

@galbarm We haven’t heard back from you on the ticket. Just checking to see if the recent improvements helped?

@galbarm

Our team checked on this further after the comment @Bysmyyr — may I know if it helped?

@galbarm We haven’t heard back from you on the ticket. Just checking to see if the recent improvements helped?

Hi,
I can’t tell if it helped because my workaround was to delete-create the whole collection for each update instead of using the update API, and this is how my system currently works.
This is not perfect because a failure after delete but before the creation is dangerous, but I had no other option.

@galbarm

Seems like you have some regression that causes this error to now occur for every (large enough) request.
Even the delete-create workaround doesn’t help now.
You may also want to know that the request takes place even though an error is returned.
As a result and to deal with that, this is how our code currently looks like:

        case result if result.status == 200 => result.body[JsValue]

        //workaround the slow Postman servers. see https://github.com/postmanlabs/postman-app-support/issues/8213
        case result if result.status == 500 && result.body.contains("Something went wrong with the server") =>
          logger.debug("finishing with success (even though postman 500), because we've observed that the collection gets updated regardless of the error.")
          result.body[JsValue]

        case result => throw HttpResponseException(result)

Please try not to change anything, unless you actually fix it.

@RonMiltonPing

Seeing the same behavior. Our collection is about 3 MB, 300+ requests with a lot of documentation. Put call to Collections returns a 504 after a minute but the collection gets updated a few minutes later. Have not tried the delete-create approach yet.

@kszafran

We had to remove most of the descriptions from our collection to lower the overall size, and now we get 500s only sometimes… It’s still pretty disappointing.

@AndrewGuenther

I’m seeing the 500 behavior as well. My collection file is only 350KB and I get a 500 error 100% of the time, but the collection does actually update. Similar use case to the requester: We want to update a collection from within our CI system. Here’s the exact curl request:

curl -v --location -g --request PUT "https://api.getpostman.com/collections/$collection_uid" 
--header "X-Api-Key: $POSTMAN_API_KEY" 
--header 'Content-Type: application/json' 
--data-binary '@postman.json'

@juliehubs

I have also been seeing this issue, has there been any solution for this?
Thanks!

@kszafran

I our case (same company as the OP), this is still the workaround that we’re using:

We had to remove most of the descriptions from our collection to lower the overall size, and now we get 500s only sometimes… It’s still pretty disappointing.

We’ll be looking into alternative ways to publish our API documentation. For just making requests from the Postman app we can deal with no descriptions. I haven’t seen 500s in a long time now.

@AndrewGuenther

My workaround has been no longer using Postman 🤷‍♂️

@kszafran

@AndrewGuenther Have you switched to some alternative solution that you could recommend?

@AndrewGuenther

I’ve been using Paw and have been pretty happy with it so far.

@bpedro

Hey everyone, thanks for all your comments and patience with this issue.

We have been working on a new way of updating individual collection items (requests, folders, responses).

Please let me know if you’d be interested in testing the new endpoint.

@gbarmashiahflir

Hey everyone, thanks for all your comments and patience with this issue.

We have been working on a new way of updating individual collection items (requests, folders, responses).

Please let me know if you’d be interested in testing the new endpoint.

I’ll be happy to

@gbarmashiahflir

@bpedro Can I get access to the new endpoint? Our API is large and is suffering from serious issues when trying to update the whole collection.

@bpedro

Hi @gbarmashiahflir, thanks for your patience.

We are getting in touch with you privately with information about the individual collection items operations.

@abrunke

We have recently started to get 504 errors when retrieving the collection via the post API using Newman.

Newman logs are as follows

2022-10-27T12:02:27.091-07:00	error: collection could not be loaded

2022-10-27T12:02:27.091-07:00	Error fetching the collection from the provided URL. Ensure that the URL is valid.

2022-10-27T12:02:27.091-07:00	Error fetching collection, the provided URL returned status code: 504

On retrying this is fine but it does cause the test via Newman to fail which is annoying.

Any suggestions? I can share the URL privately if that helps

@bpedro

@davidespihernandez

Hi! Related to the PUT operation failing for big collections, we already have exposed an endpoint that allows updating collection individual items (requests, folders, and responses). You can find documentation and examples here: https://www.postman.com/postman/workspace/postman-public-workspace/collection/16473433-f2f0cb8f-609d-443f-913c-9831187c326e?ctx=documentation

In addition, we have been improving the performance of the PUT and POST collections endpoints, but there will always be a limitation… I mean, we won’t process a collection of 100MB in a single PUT. In case of huge collections, the recommendation is to split them into smaller ones or use the collection individual items endpoint if possible.

  • Remove From My Forums
  • Question

  • User-539691603 posted

    I created a Post method and when i go to run this method on the Postman, it doesn’t work. 

    Controller:

    [Route("api/[controller]")]
    public class OptOutClientController : Controller
    {
    private IOptOutCreateService optOutCreateService;

    HttpClient httpClient = new HttpClient();

    public OptOutClientController(IOptOutCreateService optOutCreateService)
    {
    this.optOutCreateService = optOutCreateService;
    }

    [HttpPost]
    public async Task<IActionResult> OptOutPostClient([FromBody]OptOutRequest client)
    {
    if (client == null)
    throw new OptOutException( "Favor informar os dados do OptOut!");

    var result = await optOutCreateService.Process(new OptOutCreateCommand(client.Cpf, client.Email, client.Telefone, client.Bandeira, client.Canal));

    return Ok(new ApiReturnItem<OptOutResult> { Item = result, Success = true });
    }

    }

    How can i put a screenshot here? I’m not getting to do this.

    Postman

Answers

  • User475983607 posted

    pnet

    I wrote this code(i’m writting). I’m starting to write this code, then i have nothing, only one controller and some class.

    As I explained several time now..  Echo back the input to verify you’ve correctly formatted the request.

    namespace CoreApi.Controllers
    {
        [Route("api/[controller]")]
        [ApiController]
        public class HomeController : Controller
        {
            [HttpPost]
            public int Postar([FromBody]int teste)
            {
                return teste;
            }
        }
    }

    PostMan Url: https://localhost:44394/api/Home

    Body: 1

    Note the body does NOT contain {«teste» : 1}.

    • Marked as answer by

      Thursday, October 7, 2021 12:00 AM

  • User753101303 posted

    pnet

    Error 404: http://localhost:55522/api/optoutclient/optoutpostclient

    As explained the url is wrong and should not include the action name. You shouldn’t have this any more now.

    pnet

    Error 500: http://localhost:55522/api/optoutclient

    As explained it means you have a server side exception. If you still have this problem you should start from the exact exception message you have (client is likely null but it’s best to always start from an actual error message rather than trying to guess
    from the code).

    • Marked as answer by
      Anonymous
      Thursday, October 7, 2021 12:00 AM

Я создаю API, используя flask для сети
у меня уже есть база данных, и запрос GET работает, но когда я пытаюсь выполнить POST, он дает мне эту ошибку

500 INTERNAL SERVER ERROR

Это код, который я написал

#User_schema
class UserSchema(ma.Schema):
 class Mata:
  fields = ('id', 'name', 'Email', 'Pass', 'Phone', 'Department', 'Major')

#init_schema
user_schema = UserSchema()
users_schema = UserSchema(many=True)

#create user
@app.route('/user', methods=['POST'])
def add_User():
 #id = request.json['id']
 name = request.json['name']
 Email = request.json['Email']
 Pass = request.json['Pass']
 #Phone = request.json['Phone']
 Department = request.json['Department']
 Major = request.json['Major']

 new_user = User(name, Email, Pass, Department, Major)
 db.session.add(new_user)
 db.session.commit()

 return user_schema.jsonify(new_user)

Это запрос, который я добавил на почту человека

{
    "name": "User 1",
    "Email": "User1@.com",
    "Pass": "qq1",
    "Phone": "0551",
    "Department": "IT 1",
    "Major": "IT 1"
}

Я также использую локальный сервер
я посмотрел на другие ссылки, и все просят журналы, и если я не ошибаюсь, я думаю, что я получаю их от

View > Developer > Show DevTools > Console

И это скриншот журнала: (я думаю)

В чем именно проблема я не понимаю

Обновлено: Вот полный код:

from flask import Flask, request, jsonify
from flask_sqlalchemy import SQLAlchemy
from flask_marshmallow import Marshmallow
import os

app = Flask(__name__)
basedir = os.path.abspath(os.path.dirname(__file__))
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///db.db'
app.config['SQLALCHEMY_TRACK_MODIFICATION'] = False
db = SQLAlchemy(app)
ma = Marshmallow(app)

class User (db.Model):
 id = db.Column(db.Integer,primary_key=True)
 name = db.Column(db.String(30))
 Email = db.Column(db.String(30))
 Pass = db.Column(db.String(30))
 Phone = db.Column(db.Integer)
 Department = db.Column(db.String(30))
 Major = db.Column(db.String(30))
 meeting = db.relationship('Meeting', backref='creator')
 meetingroom = db.relationship('MeetingRoom', backref='reserver')

    def _init_(self, name, Email, Pass, Phone, Department, Major):
  self.name = name
  self.Email = Email
  self.Pass = Pass
  self.Phone = Phone
  self.Department = Department
  self.Major = Major

class MeetingRoom (db.Model):
 mrid = db.Column(db.Integer,primary_key=True)
 reserver_id = db.Column(db.Integer, db.ForeignKey('user.id'))
 #meetingm = db.relationship('Meeting', backref='roomno')
 mid = db.Column(db.Integer, db.ForeignKey('meeting.Mid'))

class Meeting (db.Model):
 Mid = db.Column(db.Integer,primary_key=True)
 Mname = db.Column(db.String(100))
 Des = db.Column(db.String(100))
 Date = db.Column(db.String(20))
 creator_id = db.Column(db.Integer, db.ForeignKey('user.id'))
 meetingroomm = db.relationship('MeetingRoom', backref='mroom')
 #roomno_id = db.Column(db.Integer, db.ForeignKey('meetingroom.mrid')


##json 
@app.route('/users', methods=['GET'])
def getuser():
 users = User.query.all()
 output = []
 for user in users:
  user_data = {}
  user_data['id'] = user.id
  user_data['name'] = user.name
  user_data['Email'] = user.Email
  user_data['Pass'] = user.Pass
  user_data['Phone'] = user.Phone
  user_data['Department'] = user.Department
  user_data['Major'] = user.Major
  output.append(user_data)
 return jsonify({'users' : output})


#User_schema
class UserSchema(ma.Schema):
 class Mata:
  fields = ('id', 'name', 'Email', 'Pass', 'Phone', 'Department', 'Major')

#init_schema
user_schema = UserSchema()
users_schema = UserSchema(many=True)

#create user
@app.route('/user', methods=['POST'])
def add_User():
 #id = request.json['id']
 name = request.json['name']
 Email = request.json['Email']
 Pass = request.json['Pass']
 #Phone = request.json['Phone']
 Department = request.json['Department']
 Major = request.json['Major']

 new_user = User(name, Email, Pass, Department, Major)
 db.session.add(new_user)
 db.session.commit()

 return user_schema.jsonify(new_user)

#meeting_schema
class MeetingSchema(ma.Schema):
 class Mata:
  fields = ('Mid', 'Mname', 'Des', 'Date', 'creator_id')

#init_schema
meeting_schema = MeetingSchema()
meetings_schema = MeetingSchema(many=True)

#create meeting
@app.route('/meeting', methods=['POST'])
def add_meeting():
 Mname = request.json['Mname']
 Des = request.json['Des']
 Date = request.json['Date']


 new_meeting = Meeting(Mname, Des, Date)
 db.session.add(new_meeting)
 db.session.commit()

 return user_schema.jsonify(new_meeting)


if __name__ == '__main__':
 app.run(debug=True)

2-е Обновлено: журнал консоли

После добавления ошибки определения:

cursor.execute(statement, parameters)
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) database is locked
[SQL: INSERT INTO user (name, "Email", "Pass", "Phone", "Department", "Major") VALUES (?, ?, ?, ?, ?, ?)]
[parameters: ('User 1', 'User1@.com', 'qq1', '0551', 'IT 1', 'IT 1')]
(Background on this error at: http://sqlalche.me/e/e3q8)
--Scan 1 item.
[
  {
    "hid": 1783,
    "plu": "012000151163",
    "qty": 1,
    "price": "3.74",
    "userid": "mark",
    "scandatetime": "2017-10-20 12:12:07.012"
  }
]
*** Service (httputils2service) Create ***
** Service (httputils2service) Start **
--Successfully posted from B4A app to web service.
--Web service response:
{
    "items": [
        {
            "RecordsInserted": "ok"
        }
    ]
}
** Activity (uploadscandetail) Pause, UserClosed = true **
** Activity (setup) Resume **
** Activity (setup) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (scan) Create, isFirst = false **
** Activity (scan) Resume **
** Activity (scan) Pause, UserClosed = false **
** Activity (scan) Create, isFirst = false **
** Activity (scan) Resume **
** Activity (scan) Pause, UserClosed = false **
** Activity (scan) Create, isFirst = false **
** Activity (scan) Resume **
** Activity (scan) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (setup) Create, isFirst = false **
** Activity (setup) Resume **
** Activity (setup) Pause, UserClosed = false **
** Activity (uploadscandetail) Create, isFirst = false **
** Activity (uploadscandetail) Resume **
--Trying 7 records, which are all the same PLU item.
--It will fail with 500 internal server error.
--Following JSON character count: 1151
[
  {
    "hid": 1783,
    "plu": "012000151163",
    "qty": 1,
    "price": "3.74",
    "userid": "mark",
    "scandatetime": "2017-10-20 12:14:17.821"
  },
  {
    "hid": 1783,
    "plu": "012000151163",
    "qty": 1,
    "price": "3.74",
    "userid": "mark",
    "scandatetime": "2017-10-20 12:14:18.445"
  },
  {
    "hid": 1783,
    "plu": "012000151163",
    "qty": 1,
    "price": "3.74",
    "userid": "mark",
    "scandatetime": "2017-10-20 12:14:19.076"
  },
  {
    "hid": 1783,
    "plu": "012000151163",
    "qty": 1,
    "price": "3.74",
    "userid": "mark",
    "scandatetime": "2017-10-20 12:14:19.696"
  },
  {
    "hid": 1783,
    "plu": "012000151163",
    "qty": 1,
    "price": "3.74",
    "userid": "mark",
    "scandatetime": "2017-10-20 12:14:20.359"
  },
  {
    "hid": 1783,
    "plu": "012000151163",
    "qty": 1,
    "price": "3.74",
    "userid": "mark",
    "scandatetime": "2017-10-20 12:14:21.260"
  },
  {
    "hid": 1783,
    "plu": "012000151163",
    "qty": 1,
    "price": "3.74",
    "userid": "mark",
    "scandatetime": "2017-10-20 12:14:23.341"
  }
]
ResponseError. Reason: Internal Server Error, Response: <!DOCTYPE html>

<html><head>

<title>500 Internal Server Error</title>

</head><body>

<h1>500 Internal Server Error</h1>

The server encountered a fatal error processing this request and could not continue.

<p>

<hr>

<address>Alpha Anywhere Application Server Application Server/12.0 Build/4119-4825 at SAV-APP1 Port 80</address>

</body></html>
** Activity (uploadscandetail) Pause, UserClosed = true **
** Activity (setup) Resume **
** Activity (setup) Pause, UserClosed = false **
** Activity (scanneditemsview) Create, isFirst = false **
** Activity (scanneditemsview) Resume **
** Activity (scanneditemsview) Pause, UserClosed = true **
** Activity (setup) Resume **
** Activity (setup) Pause, UserClosed = false **
** Activity (uploadscandetail) Create, isFirst = false **
** Activity (uploadscandetail) Resume **
--I then deleted one record, making 6 records.
--All the same PLU items.
--Post works fine.
--Following JSON character count: 987
[
  {
    "hid": 1783,
    "plu": "012000151163",
    "qty": 1,
    "price": "3.74",
    "userid": "mark",
    "scandatetime": "2017-10-20 12:14:17.821"
  },
  {
    "hid": 1783,
    "plu": "012000151163",
    "qty": 1,
    "price": "3.74",
    "userid": "mark",
    "scandatetime": "2017-10-20 12:14:18.445"
  },
  {
    "hid": 1783,
    "plu": "012000151163",
    "qty": 1,
    "price": "3.74",
    "userid": "mark",
    "scandatetime": "2017-10-20 12:14:19.696"
  },
  {
    "hid": 1783,
    "plu": "012000151163",
    "qty": 1,
    "price": "3.74",
    "userid": "mark",
    "scandatetime": "2017-10-20 12:14:20.359"
  },
  {
    "hid": 1783,
    "plu": "012000151163",
    "qty": 1,
    "price": "3.74",
    "userid": "mark",
    "scandatetime": "2017-10-20 12:14:21.260"
  },
  {
    "hid": 1783,
    "plu": "012000151163",
    "qty": 1,
    "price": "3.74",
    "userid": "mark",
    "scandatetime": "2017-10-20 12:14:23.341"
  }
]
{
    "items": [
        {
            "RecordsInserted": "ok"
        }
    ]
}
** Activity (uploadscandetail) Pause, UserClosed = true **
** Activity (setup) Resume **
** Activity (setup) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = true **

Понравилась статья? Поделить с друзьями:
  • Postman ssl error unable to verify the first certificate
  • Postman cloud agent error cannot send requests to localhost select a different agent
  • Postingformjs error other groupadvert
  • Postimg cc ошибка 404
  • Postimage ошибка 404