elasticio / salesforce-component

elastic.io component that connects to Salesforce API (node.js)
Apache License 2.0
3 stars 7 forks source link

Action: Create Object throws error massage on valid request #69

Closed stas-fomenko closed 5 years ago

stas-fomenko commented 5 years ago

Description: Action is unable to create new objects, probably the reason is some salesforce api changes, as now action try to use invalid request URL: see logs - Sending POST request to https://na98.salesforce.com/services/data/v[object Object]/sobjects/Contact

STR:

  1. Create flow: simple trigger-> salesforce: Action: Create Object
  2. Action: Create Object Input: Object: Cointact extID: generate UUID here Last Name: "some_lastname_test_00001"
  3. Retrieve sample
  4. See error message

AR: error show:

Error!
Unexpected return code 404, expected 201, body [{"errorCode":"NOT_FOUND","message":"The requested resource does not exist"}]

logs:

Error: Unexpected return code 404, expected 201, body [{"errorCode":"NOT_FOUND","message":"The requested resource does not exist"}]
    at Request.checkResponse [as _callback] (/home/apprunner/lib/helpers/http-utils.js:93:33)
    at Request.self.callback (/home/apprunner/node_modules/request/request.js:185:22)
    at emitTwo (events.js:126:13)
    at Request.emit (events.js:214:7)
    at Request.<anonymous> (/home/apprunner/node_modules/request/request.js:1161:10)
    at emitOne (events.js:116:13)
    at Request.emit (events.js:211:7)
    at IncomingMessage.<anonymous> (/home/apprunner/node_modules/request/request.js:1083:12)
    at Object.onceWrapper (events.js:313:30)
    at emitNone (events.js:111:20)
    at IncomingMessage.emit (events.js:208:7)
    at endReadableNT (_stream_readable.js:1064:12)
    at _combinedTickCallback (internal/process/next_tick.js:139:11)
    at process._tickCallback (internal/process/next_tick.js:181:9)
invokeModuleFunction – init is not found
Component execution initialized successfully
processMessage received
Sending post request to https://login.salesforce.com/services/oauth2/token
Have got 200 response from post to https://login.salesforce.com/services/oauth2/token
Refreshed token from https://{{prodEnv}}.salesforce.com/services/oauth2/token
processMessage emit updateKeys
Sending POST request to https://na98.salesforce.com/services/data/v[object Object]/sobjects/Contact
Unexpected return code 404, expected 201, body [{"errorCode":"NOT_FOUND","message":"The requested resource does not exist"}]
at emitTwo (events.js:126:13)
at Request.<anonymous> (/home/apprunner/node_modules/request/request.js:1161:10)
at Request.emit (events.js:211:7)
at _combinedTickCallback (internal/process/next_tick.js:139:11)
message: 'The requested resource does not exist' } ],
statusCode: 404 } Error: Unexpected return code 404, expected 201, body [{"errorCode":"NOT_FOUND","message":"The requested resource does not exist"}]
at Request.checkResponse [as _callback] (/home/apprunner/lib/helpers/http-utils.js:93:33)
at Request.emit (events.js:214:7)
at Request.emit (events.js:211:7)
at Object.onceWrapper (events.js:313:30)
at Request.checkResponse [as _callback] (/home/apprunner/lib/helpers/http-utils.js:93:33)
at Request.emit (events.js:214:7)
at IncomingMessage.<anonymous> (/home/apprunner/node_modules/request/request.js:1083:12)
at emitNone (events.js:111:20)
at IncomingMessage.emit (events.js:208:7)
at Request.self.callback (/home/apprunner/node_modules/request/request.js:185:22)
at emitTwo (events.js:126:13)
at Request.<anonymous> (/home/apprunner/node_modules/request/request.js:1161:10)
at _combinedTickCallback (internal/process/next_tick.js:139:11)
at emitOne (events.js:116:13)
at endReadableNT (_stream_readable.js:1064:12)
responseBody:
emitting SalesforceEntity error { Error: Unexpected return code 404, expected 201, body [{"errorCode":"NOT_FOUND","message":"The requested resource does not exist"}]
at Request.self.callback (/home/apprunner/node_modules/request/request.js:185:22)
at Object.onceWrapper (events.js:313:30)
at process._tickCallback (internal/process/next_tick.js:181:9)
[ { errorCode: 'NOT_FOUND',
at emitOne (events.js:116:13)
at IncomingMessage.<anonymous> (/home/apprunner/node_modules/request/request.js:1083:12)
at emitNone (events.js:111:20)
at IncomingMessage.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1064:12)
at process._tickCallback (internal/process/next_tick.js:181:9)
processMessage emit error
processMessage emit end

ER: New object created accordingly

A3a3e1 commented 5 years ago

Looks like this issue has already been solved. But should be additionally checked

dvd-z commented 5 years ago

works for me 👍

stas-fomenko commented 5 years ago

the bug can not be reproduced, as it was fixed previously