Skip to main content

I’m trying to modify the data-connector-example code to import issues from Linear rather than folders, and show them in the data linking panel in the same way, with parentId.
I could get OAuth to Linear and getting the data from it to work fine, code at https://github.com/ShoggothAI/sample-lucid-extensions/tree/linear/linear-connector-example

However when the code tries to insert the data so it’s visible in the  Data Linking Panel, I keep getting the error 
 

Listening on port 3002
Linear Import initiated
Fetching issues from Linear
Successfully retrieved issues from Linear GraphQL API
Error encountered when updating Linear collections DataConnectorRequestError: updating data source
at throwUnsuccessful (/home/.../tweaked-lucid-extensions/linear-connector-example/dataconnectors/linear-connector/node_modules/lucid-extension-sdk/dataconnector/throwunsuccessful.js:8:15)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async DataSourceClient.update (/home/.../tweaked-lucid-extensions/linear-connector-example/dataconnectors/linear-connector/node_modules/lucid-extension-sdk/dataconnector/datasourceclient.js:60:9) {
status: 500,
response: 'Unable to save changes to document: e7f3bbf0-7e3b-4b1d-a89b-566cb391169a. Reason: 400-{"b9e7251b-03c6-b403-270e-5a73ed9741cb":"Item - {\\"linearId\\":\\"75f46911-f590-4698-bab0-3c73d0597875\\",\\"title\\":\\"Test Issue for Attachments d5f61612\\",\\"parentId\\":null} - was sent with the incorrect key 75f46911-f590-4698-bab0-3c73d0597875 expected \\"75f46911-f590-4698-bab0-3c73d0597875\\". To change keys use ItemsTransferred"}',
statusText: 'Internal Server Error'
}

The code there is as similar to the one for importing Lucid folders in the example as I can make it, yet the latter runs fine and this one breaks. Any idea how to fix that?
Thanks a lot!

Hello Dagan, 

I am currently investigating your question and will have a response when I have some ideas.


Sorry for the delay Dagan, I am still researching causes. Will be in touch.


Thanks a lot for investigating! I hope you've been able to reproduce the issue from the repo I shared?


Hi Dagon, thank you for waiting. I’ve been helping Michael look at this issue.

I believe the problem comes from the primary key in your issueSchema being a String, whereas in the Lucid example it is a Number. The error message says that it expects quotes around the id, so it seems like it can’t parse it correctly as a string.

In your import action, line 19, could you try converting the id to a string before passing it into the request, like this:

JSON.stringify(apiIssue.id),

 


Reply