n8n icon indicating copy to clipboard operation
n8n copied to clipboard

Monday.com - Problem in node ‘Add update to item‘

Open niclm opened this issue 1 year ago • 6 comments

Describe the bug When using the Monday.com Add Update operation using OAuth credentials, the following error occurs:

ERROR: Cannot read properties of undefined (reading 'create_update')

To Reproduce

  1. Open nodes panel and search for Monday.com
  2. Select the Add an update to an item action
  3. Open the newly added node and enter in the following:
  • Credential to connect with: Select an OAuth credential that has been given full scope permissions
  • Resource: Select Board Item
  • Operation: Select Add Update
  • Item ID: Add a valid board item id
  • Update Text: Add a string value of Test
  1. Click Test step
  2. See error

Expected behaviour A new update should be created. NB: This works perfectly fine when using an API key, just not with OAuth.

Environment:

  • OS: Ubuntu Linux 22.04
  • n8n Version: 1.25.1
  • Node.js Version: v18.19.0
  • Database system: SQLite
  • Operation mode: main

Additional context

TypeError: Cannot read properties of undefined (reading 'create_update')
    at Object.execute (/usr/lib/node_modules/n8n/node_modules/n8n-nodes-base/nodes/MondayCom/MondayCom.node.ts:479:40)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at Workflow.runNode (/usr/lib/node_modules/n8n/node_modules/n8n-workflow/src/Workflow.ts:1322:8)
    at /usr/lib/node_modules/n8n/node_modules/n8n-core/src/WorkflowExecute.ts:1046:29
image

niclm avatar Feb 01 '24 22:02 niclm

Hey @niclm,

Thanks for reporting this one, it looks like the api may no longer be returning the field we are expecting. I will dig into the api docs for Monday in the morning and see if I can spot what has changed.

Joffcom avatar Feb 02 '24 00:02 Joffcom

Hey @niclm,

I have taken a look and at first I wasn't able to reproduce it but once I changed from API Token to OAuth that got it failing, I have created NODE-1102 as the internal ticket to fix tthis. For now if possible if you use an API Token it should get you up and running.

Joffcom avatar Feb 02 '24 16:02 Joffcom

I discovered something that may be worth looking into. I tried interacting with the Monday API directly using an HTTP Request node, however I noticed in the response that I lacked permissions to create an update: image

I went back to verify the scope in Monday.com and can see that I have enabled the permission correctly. I verified this by clicking on the OAuth Authorisation URL that Monday provides, I saw that the scope was within the list: image

When I connect via n8n I am presented with a different scope, which is missing updates:write: image

I then manually created a Generic Credential Type and I was able to see the correct scope, and once authorised I was able to successfully create an update 🥳

Does the predefined credential type for Monday have the correct Authorisation URL ?

niclm avatar Feb 04 '24 21:02 niclm

Hey @niclm,

That could be it, Our credential only sets boards:write and boards:read so when we connect to Monday this is all we will request. It makes sense for the error to be with the response not matching what we are using, I can get that updated shortly.

With the authorization url we use https://auth.monday.com/oauth2/authorize which is what the Monday docs point to for the OAuth flow.

Joffcom avatar Feb 05 '24 10:02 Joffcom

Ah ha! Would it make sense to add checkboxes to specify the scope you need? Or would it make sense to just not set the scope at all from n8n, since that can be managed on Monday?

niclm avatar Feb 05 '24 11:02 niclm

That is something I will need to check in their API docs to see what they recommend.

Joffcom avatar Feb 05 '24 13:02 Joffcom