nylas/nylas-nodejs

Bad Request when update the event

Closed this issue · 5 comments

Source code

import { getConnection } from '../client';

const nylas = getConnection()

async function update(id:string) {
  const event = await nylas.events.find(id)
  event.title='new title'
  const res = await event.save()
  console.log(res)
}

update('et0kr6fovbr5syanag4f7pf7w')

Error msg Bad Request: Visibility cannot have the value ''

the sdk should omit the event.visibility when sending the update request.

@ianzone have you tried specifying 'null' as default, does that work for you?

@ianzone have you tried specifying 'null' as default, does that work for you?

There is always a remedial measure, but my point is the SDK should do the job as the docs described.
image

Thanks for raising this point @ianzone. I have just reproduced the issue and we'll be looking to fix this. Thank you for reporting it!

approach to fix: Need to ensure to nullify visibility before sending the payload if visibility is an empty string