Creating item in Node.js SDK

I have a collection on my site to store emails (up to 5). Each field is titled 1_email, 2_email, 3_email… However when I run my Node.js code to create items in the collection, I get a Validation Failure error sometimes, but other times it works. Each email field is set to the email type. It has never worked when I try passing up email values, but it sometimes works when I leave those fields blank. Here is my code, any ideas why this is happening?

var fields = {}
fields["name"] = "test_name"
fields["slug"] = "test_slug"
fields["_archived"] = false
fields["_draft"] = false
fields["1_email"] = "test@gmail.com"

const item = api.createItem({
  collectionId: collection_id,
  fields: fields,
}, { live: true });

hmm… this is a tough one, lets bring out the big guns :smiley:
@Waldo @rileyrichter @matthewpmunger @mattvaru

2 Likes

I’m unfortunately a little out-of-my-element on this one, but your other tagged members might be able to assist! Hope you get some help on this one soon @Zach_Cmiel :smile:

1 Like

Update: I was able to output the error problem and it looks like it’s saying that the email “field is not described in schema.” However when I print out all of the fields in the collection, it appears and is editable. For more reference, the field is an Email field called “1_email”