0

Good afternoon. The following code returns a weird error. I've looked at https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_attachment.html as a guide and from what I can tell, all of my settings are configured appropriately. Any reason why it's returning a weird error? usually it references a line in my code that returns the error but for some reason it does not. Is this because the error does not occur within my code?

var jsforce = require('jsforce');
var conn = new jsforce.Connection();
const fs = require('fs')
require('dotenv').config()
user = process.env.USER
pass = process.env.PASS

conn.login(user, pass, function(err, res) {
  if (err) { return console.error(err); }
  fs.readFile('2d.png',function(err, image){
    if(err){return console.log(err)}
      base64data = new Buffer.from(image, 'base64')
      conn.sobject('Attachment').create({
        ParentId: 'a7L3o000002J0YW',
        Name: '2d.png',
        Body: base64data
       }, function(err,res){
         if(err){return console.log(err)}
         console.log(res)
       })
    })

  })

Error:

INVALID_FIELD: No such column 'type' on sobject of type Attachment
    at HttpApi.getError (C:\Users\paulp\Desktop\Projects\JSForce Playground\node_modules\jsforce\lib\http-api.js:250:13)
    at C:\Users\paulp\Desktop\Projects\JSForce Playground\node_modules\jsforce\lib\http-api.js:95:22
    at tryCallOne (C:\Users\paulp\Desktop\Projects\JSForce Playground\node_modules\promise\lib\core.js:37:12)
    at C:\Users\paulp\Desktop\Projects\JSForce Playground\node_modules\promise\lib\core.js:123:15
    at flush (C:\Users\paulp\Desktop\Projects\JSForce Playground\node_modules\asap\raw.js:50:29)
    at processTicksAndRejections (internal/process/task_queues.js:79:11) {
  name: 'INVALID_FIELD',
  errorCode: 'INVALID_FIELD'
}
4
  • 1
    Please do not delete and repost questions. You are always welcome to edit your question to add information or improve it. Thank you!
    – David Reed
    Oct 4, 2020 at 19:51
  • 1
    A scan of the codebase suggests that this shouldn't be happening on current JSforce. Are you using the latest version? You may need to open an issue against the project's repository.
    – David Reed
    Oct 4, 2020 at 20:12
  • I'm sorry for remaking the question. I am using the latest version, v. 1.10.0 and I have opened an issue against the project's repository. I'm really new to all of this and so for future reference, if the error doesn't specify anything in my code, only things in the libraries, it's probably an issue with the project, right?
    – PaulyP
    Oct 15, 2020 at 20:49
  • Possibly, but not necessarily. Your project may in some situations consume or set up functionality from a library incorrectly in a way that would product a library-only stack trace.
    – David Reed
    Oct 15, 2020 at 23:17

0

You must log in to answer this question.

Browse other questions tagged .