This is most likely a rookie mistake but any help would be appreciated.... I am trying to update a document in cosmosDB from my node app (using PUG). But when I invoke the replace method...
async updateItem(item) {
const itemId = item.ticketId;
const {resource: replaced } = await this.tickets.item(itemId,itemId).replace(item);
return replaced;
}
I get the following error:
RangeError [ERR_HTTP_INVALID_STATUS_CODE]: Invalid status code: TypeError:
C:\Users\donko\OneDrive\vscode\appstart\views\editticket.pug:30
28| .form-group
29| label.ticket-label(for='fk_ticket_status') Ticket Status :
> 30| select(name="fk_ticket_status" value=ticket.fk_ticket_status required
So my question is why is the call to the CosmosDb replace method failing on the page? I haven't gotten to the point where my code should be re-rendering the page? the item object is called via my router as:
async updateTicket(req, res) {
await this.ticketModel.updateItem(req.body);
By comparison, my addItem function works just fine:
async addItem(item) {
debug('Adding a ticket to the database')
item.submitted_date = Date.now();
item.fk_ticket_status = 1;
item.assigned_to = '';
item.parent = '';
const { resource: doc } = await this.tickets.items.create(item)
return doc
}