Skip to content
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

Getting error details #83

Closed
olliechick opened this issue Jul 22, 2021 · 3 comments
Closed

Getting error details #83

olliechick opened this issue Jul 22, 2021 · 3 comments

Comments

@olliechick
Copy link
Contributor

When using the bulk create offer endpoint, e.g.:

try {
	return await this.ebay.sell.inventory.bulkCreateOffer({ requests });
} catch (e) {
	console.log(e);
}

I get this from the console:

EBayError: Request failed with status code 400
    at new EBayError ([REPO]\node_modules\@hendt\ebay-api\src\errors\index.ts:17:5)
    at Object.exports.handleEBayError ([REPO]\node_modules\@hendt\ebay-api\src\errors\index.ts:179:2)
    at Inventory.<anonymous> ([REPO]\node_modules\@hendt\ebay-api\src\api\restful\index.ts:204:7)
    at step ([REPO]\node_modules\@hendt\ebay-api\lib\api\restful\index.js:57:23)
    at Object.throw ([REPO]\node_modules\@hendt\ebay-api\lib\api\restful\index.js:38:53)
    at rejected ([REPO]\node_modules\@hendt\ebay-api\lib\api\restful\index.js:30:65)
    at processTicksAndRejections (internal/process/task_queues.js:95:5) {
  meta: {
    res: { status: 400, statusText: 'Bad Request', headers: [Object] },
    req: {
      url: 'https://api.ebay.com/sell/inventory/v1/bulk_create_offer',
      method: 'post',
      headers: [Object],
      params: undefined
    },
    [Symbol(raw-error)]: Error: Request failed with status code 400
        at createError ([REPO]\node_modules\axios\lib\core\createError.js:16:15)
        at settle ([REPO]\node_modules\axios\lib\core\settle.js:17:12)
        at Unzip.handleStreamEnd ([REPO]\node_modules\axios\lib\adapters\http.js:260:11)
        at Unzip.emit (events.js:376:20)
        at endReadableNT (internal/streams/readable.js:1336:12)
        at processTicksAndRejections (internal/process/task_queues.js:82:21) {
      config: [Object],
      request: [ClientRequest],
      response: [Object],
      isAxiosError: true,
      toJSON: [Function: toJSON]
    }
  }
}

This is the response I get when sending the request to eBay via their web tool, which includes the duplicated offer ID that I need. I can't find any way to get this from the e that is thrown by the bulkCreateOffer request.

{
  "responses": [
    {
      "statusCode": 400,
      "sku": "REDACTED",
      "marketplaceId": "EBAY_AU",
      "format": "FIXED_PRICE",
      "warnings": [],
      "errors": [
        {
          "errorId": 25002,
          "domain": "API_INVENTORY",
          "subdomain": "Selling",
          "category": "REQUEST",
          "message": "A user error has occurred. Offer entity already exists.",
          "parameters": [
            {
              "name": "offerId",
              "value": "78...[REDACTED]...18"
            }
          ]
        }
      ]
    }
  ]
}
@dantio
Copy link
Collaborator

dantio commented Jul 25, 2021

Thank you for reporting this. I'll improve the error handling here.

@dantio
Copy link
Collaborator

dantio commented Jul 25, 2021

@olliechick
I have released v3.3.0.

The reponses should be available in meta.res.data.responses. Please check if it works for you.

@olliechick
Copy link
Contributor Author

Yes that works for me, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants