Closed that1guy closed 9 years ago
I just noticed something - for an update, the PUT
HTTP verb should be used and not POST
... there appears to be a bug in that POST would actually let a client do that. This would, in theory, result in multiple (duplicate) postings in the API if POST was allowed this way.
You added the question label to this -- are you asking me something? Cause if you are I have no idea.. :) Also, would like to have this working by Wednesday at latest since I'm pitching that evening to a few Angel investors.
Josh, can we get this fixed before 6p? I'm pitching product tonight to a few interested angle investors. Thanks for help!
I'll shift to explore this now - have you updated the UI code to make PUT request instead of POST?
Oh, no. Is that this issue? Sorry I may have misunderstood. Checking.
HashtagSell.com p: 415.294.1981 e: brad.davis@hashtagsell.com
On Thu, Apr 9, 2015 at 12:46 PM, Joshua Thomas notifications@github.com wrote:
I'll shift to explore this now - have you updated the UI code to make PUT request instead of POST?
— Reply to this email directly or view it on GitHub https://github.com/HashtagSell/posting-api/issues/25#issuecomment-91338795 .
Here's the object I get back from posting API before pushing to ebay.
{
"username": "jeanjean",
"heading": "macbook air",
"body": "<span class=\"mention-highlighter\" contenteditable=\"false\">#macbook air</span> for <span class=\"mention-highlighter-price\" contenteditable=\"false\">$40</span> <span class=\"mention-highlighter\" contenteditable=\"false\">@San Francisco, CA, United States</span> ",
"expiresAt": "2015-04-23T20:15:39.026Z",
"categoryCode": "SELE",
"annotations": [
{
"value": null,
"key": "Year"
},
{
"value": null,
"key": "Hard Drive (Gb)"
},
{
"value": null,
"key": "Memory (Gb)"
},
{
"value": null,
"key": "Screen (inches)"
},
{
"value": null,
"key": "Warranty"
}
],
"postingId": "57ceef8fdb444c81841a003b7b129361",
"ebay": null,
"language": "EN",
"images": [],
"geo": {
"accuracy": 0,
"location": {
"postalCode": "94103",
"country": "US",
"state": "CA",
"city": "San Francisco"
},
"coordinates": [
-122.41941550000001,
37.7749295
]
},
"createdAt": "2015-04-09T20:15:39.026Z",
"askingPrice": {
"value": "40",
"currency": "USD"
},
"external": {
"threeTaps": {
"location": {
"state": "CA",
"formatted": "San Francisco, CA, USA",
"country": "US",
"city": "USA-SFO-SNF"
},
"categoryGroup": "SSSS",
"category": "SELE"
},
"source": {
"code": "HSHTG"
}
}
}
Here's the put request to push to eBay.
Remote Address:127.0.0.1:4043
Request URL:http://localhost:4043/v1/postings/57ceef8fdb444c81841a003b7b129361/publish
Request Method:PUT
Request Payload: {"ebay":true}
Response from posting API
{
"name": "ResourceNotFound",
"message": "resource not found",
"method": "PUT",
"statusCode": 404,
"url": "/v1/postings/57ceef8fdb444c81841a003b7b129361/publish"
}
Node logs
21:32:52.816Z INFO posting-api: POST /v1/postings/
21:32:52.816Z TRACE posting-api: assigning ID 238b5284a95f42c9a87e2be5045ff304 to posting
21:32:52.817Z TRACE posting-api: setting default expiration of 14 days for posting
21:32:52.817Z TRACE posting-api: posting is set to expire on Thu Apr 23 2015 14:32:52 GMT-0700 (PDT)
21:32:52.820Z TRACE posting-api: creating new posting with postingId 238b5284a95f42c9a87e2be5045ff304
21:32:52.829Z TRACE posting-api: create posting 238b5284a95f42c9a87e2be5045ff304 completed in 13 milliseconds
21:33:13.255Z INFO posting-api: PUT /v1/postings/238b5284a95f42c9a87e2be5045ff304/publish
21:33:13.255Z WARN posting-api: 404: PUT /v1/postings/238b5284a95f42c9a87e2be5045ff304/publish
Ok, trying with only POST requests. Node logs.
21:42:36.163Z INFO posting-api: POST /v1/postings/
21:42:36.164Z TRACE posting-api: assigning ID 3e314732781c4e24996dca526a4390d5 to posting
21:42:36.165Z TRACE posting-api: setting default expiration of 14 days for posting
21:42:36.166Z TRACE posting-api: posting is set to expire on Thu Apr 23 2015 14:42:36 GMT-0700 (PDT)
21:42:36.170Z TRACE posting-api: creating new posting with postingId 3e314732781c4e24996dca526a4390d5
21:42:36.183Z TRACE posting-api: create posting 3e314732781c4e24996dca526a4390d5 completed in 19 milliseconds
21:42:40.085Z INFO posting-api: POST /v1/postings/3e314732781c4e24996dca526a4390d5/publish
21:42:40.089Z TRACE posting-api: find posting by ID completed in 3 milliseconds
21:42:40.094Z TRACE posting-api: no Ebay category match found for code SELE
21:42:41.430Z TRACE posting-api: request to create fixed price post with eBay completed in 1335 milliseconds
21:42:41.442Z TRACE posting-api: attempt to create eBay posting completed in 1356 milliseconds
21:42:41.443Z ERROR posting-api: 500: POST /v1/postings/3e314732781c4e24996dca526a4390d5/publish
21:42:41.444Z ERROR posting-api: unable to publish to eBay
err: {
"name": "PublishingError",
"message": "unable to publish to eBay",
"sourceError": {
"details": [
{
"ShortMessage": [
"Listing violates the Duplicate Listing policy."
],
"LongMessage": [
"This Listing is a duplicate of your item: macbook air (110157906941). Under the Duplicate Listing policy, sellers can't have multiple Fixed Price listings, multiple Auction-style (with the Buy It Now option) listings, or in both the Fixed Price and Auction-style (with the Buy It Now option) listings for identical items at the same time. We recommend you create a multiple quantity Fixed Price listing to sell identical items."
],
"ErrorCode": [
"21919067"
],
"SeverityCode": [
"Error"
],
"ErrorParameters": [
{
"$": {
"ParamID": "0"
},
"Value": [
"macbook air"
]
},
{
"$": {
"ParamID": "1"
},
"Value": [
"110157906941"
]
}
],
"ErrorClassification": [
"RequestError"
]
}
]
},
"statusCode": 500
}
Most recent logs after removing duplicate ad of ebay.
22:04:46.439Z INFO posting-api: POST /v1/postings/
22:04:46.440Z TRACE posting-api: assigning ID e6111c6a3d3a4ec59245d27e96134de9 to posting
22:04:46.440Z TRACE posting-api: setting default expiration of 14 days for posting
22:04:46.441Z TRACE posting-api: posting is set to expire on Thu Apr 23 2015 15:04:46 GMT-0700 (PDT)
22:04:46.445Z TRACE posting-api: creating new posting with postingId e6111c6a3d3a4ec59245d27e96134de9
22:04:46.457Z TRACE posting-api: create posting e6111c6a3d3a4ec59245d27e96134de9 completed in 17 milliseconds
22:04:52.806Z INFO posting-api: POST /v1/postings/e6111c6a3d3a4ec59245d27e96134de9/publish
22:04:52.814Z TRACE posting-api: find posting by ID completed in 6 milliseconds
22:04:52.817Z TRACE posting-api: no Ebay category match found for code SELE
22:04:54.284Z TRACE posting-api: request to create fixed price post with eBay completed in 1466 milliseconds
22:04:54.291Z TRACE posting-api: attempt to create eBay posting completed in 1484 milliseconds
22:04:54.294Z TRACE posting-api: find posting by ID completed in 1 millisecond
22:04:54.295Z TRACE posting-api: updating existing posting with postingId e6111c6a3d3a4ec59245d27e96134de9
22:04:54.304Z ERROR posting-api: 500: POST /v1/postings/e6111c6a3d3a4ec59245d27e96134de9/publish
22:04:54.305Z ERROR posting-api: unable to update posting by id
err: {
"name": "PersistenceError",
"message": "unable to update posting by id",
"sourceError": {
"jse_shortmsg": "save of posting e6111c6a3d3a4ec59245d27e96134de9 failed",
"jse_summary": "save of posting e6111c6a3d3a4ec59245d27e96134de9 failed: cannot use the part (ebay of ebay.endTime) to traverse the element ({ebay: null})",
"jse_cause": {
"name": "MongoError",
"code": 16837,
"err": "cannot use the part (ebay of ebay.endTime) to traverse the element ({ebay: null})"
},
"message": "save of posting e6111c6a3d3a4ec59245d27e96134de9 failed: cannot use the part (ebay of ebay.endTime) to traverse the element ({ebay: null})"
},
"statusCode": 500,
"postingId": "e6111c6a3d3a4ec59245d27e96134de9"
}
Marking as fixed now - we determined this was due to the ebay subdocument being set to null which there is now a check in the posting API model to resolve this.
Item is still pushed to eBay. But the eBay callback data seems to not be stored in db because posting couldn't be updated.
Up-to-date with most recent develop branch. Hopefully this is helpful!