AlfredoDaAs
AlfredoDaAs

Reputation: 188

Twilio taskRouter js sdk giving CORS error

Tried doing a worker.update(...), worker.completeTask(...) and always getting a CORS error from localhost.

enter image description here

Upvotes: 0

Views: 278

Answers (1)

ryan.wise
ryan.wise

Reputation: 479

Try adding this Policy to your back end. There is apparently a "bug" in the example code that Twilio provides and it has yet to be fixed.

This code is assuming a Node backend but the equivalent should work in any language

// Worker Activity update policy
new Policy({
    url: util.workersUrl(workspaceSid, workerSid),
    method: 'POST',
    postFilter: {ActivitySid: {required: true}},
    allow: true,
  })

Upvotes: 1

Related Questions