GitLab Get File node only gets the file for the first object

Describe the problem/error/question

I retrieve all files from a GitLab repo using a List Files Node. I have an output containing list of all tree and blob objects. I now want to get each file (to insert into a vector DB). I use a GitLab Get File node using the {{json.path}} expression to the file. For some reason it only gets the first file in the list but none of the others. I checked the node is NOT set to “Execute once”.

Why is it not processing the rest of the files?

What is the error message (if any)?

There’s no error. I can just see that only the first file is actually retrieved. See the Set Field" node.

Please share your workflow

{
“nodes”: [
{
“parameters”: {},
“type”: “n8n-nodes-base.manualTrigger”,
“typeVersion”: 1,
“position”: [
-360,
-60
],
“id”: “f50046dd-5ea4-474a-a074-d401346507cc”,
“name”: “When clicking ‘Execute workflow’”
},
{
“parameters”: {
“conditions”: {
“options”: {
“caseSensitive”: true,
“leftValue”: “”,
“typeValidation”: “strict”,
“version”: 2
},
“conditions”: [
{
“id”: “bbd9c94e-e493-40ac-aafc-cdc3916b1606”,
“leftValue”: “={{ $json.name.endsWith(‘md’) }}”,
“rightValue”: “={{ $json.name.includes(‘.md’) }}”,
“operator”: {
“type”: “boolean”,
“operation”: “true”,
“singleValue”: true
}
},
{
“id”: “ee561d36-5c53-4af7-9cef-952bb48cdab7”,
“leftValue”: “={{ $json.path.startsWith(‘docs/_templates’) }}”,
“rightValue”: “”,
“operator”: {
“type”: “boolean”,
“operation”: “false”,
“singleValue”: true
}
},
{
“id”: “404a5658-c27e-4370-9ce2-7da1fbad1304”,
“leftValue”: “={{ $json.path.startsWith(‘docs/contributors’) }}”,
“rightValue”: “”,
“operator”: {
“type”: “boolean”,
“operation”: “false”,
“singleValue”: true
}
}
],
“combinator”: “and”
},
“options”: {}
},
“type”: “n8n-nodes-base.if”,
“typeVersion”: 2.2,
“position”: [
300,
-60
],
“id”: “bafc611f-9499-46c6-a69f-b34662ee3e39”,
“name”: “Select relevant .md files”
},
{
“parameters”: {
“authentication”: “oAuth2”,
“resource”: “file”,
“operation”: “list”,
“owner”: “CloudSuite”,
“repository”: “cs-doc”,
“returnAll”: true,
“filePath”: “docs/features”,
“additionalParameters”: {
“recursive”: true
}
},
“type”: “n8n-nodes-base.gitlab”,
“typeVersion”: 1,
“position”: [
80,
-60
],
“id”: “f139a186-7fc0-47eb-887f-c503625a7b44”,
“name”: “List CloudSuite cs-docs/docs files”,
“credentials”: {
“gitlabOAuth2Api”: {
“id”: “t2f5vmdb8aiNqO7l”,
“name”: “GitLab account”
}
}
},
{
“parameters”: {
“authentication”: “oAuth2”,
“resource”: “file”,
“operation”: “get”,
“owner”: “CloudSuite”,
“repository”: “cs-doc”,
“filePath”: “={{ $json.path }}”,
“additionalParameters”: {
“reference”: “main”
}
},
“type”: “n8n-nodes-base.gitlab”,
“typeVersion”: 1,
“position”: [
620,
-60
],
“id”: “81edd060-2f8b-4bef-9153-e48c8d7feda6”,
“name”: “Get a file”,
“executeOnce”: false,
“credentials”: {
“gitlabOAuth2Api”: {
“id”: “t2f5vmdb8aiNqO7l”,
“name”: “GitLab account”
}
}
},
{
“parameters”: {
“assignments”: {
“assignments”: [
{
“id”: “9cafd0b4-c555-4958-b294-7d8984a5b9fa”,
“name”: “has binary data”,
“value”: “={{ $binary.data ? ‘has file’ : ‘no file’ }}”,
“type”: “string”
}
]
},
“options”: {}
},
“type”: “n8n-nodes-base.set”,
“typeVersion”: 3.4,
“position”: [
840,
-60
],
“id”: “f374d2f0-9b37-40cd-aa9a-b195e0b66c3b”,
“name”: “Edit Fields”
}
],
“connections”: {
“When clicking ‘Execute workflow’”: {
“main”: [
[
{
“node”: “List CloudSuite cs-docs/docs files”,
“type”: “main”,
“index”: 0
}
]
]
},
“Select relevant .md files”: {
“main”: [
[
{
“node”: “Get a file”,
“type”: “main”,
“index”: 0
}
]
]
},
“List CloudSuite cs-docs/docs files”: {
“main”: [
[
{
“node”: “Select relevant .md files”,
“type”: “main”,
“index”: 0
}
]
]
},
“Get a file”: {
“main”: [
[
{
“node”: “Edit Fields”,
“type”: “main”,
“index”: 0
}
]
]
},
“Edit Fields”: {
“main”: [

]
}
},
“pinData”: {},
“meta”: {
“templateCredsSetupCompleted”: true,
“instanceId”: “aecda5f62ed58d81526d0466a98bb81449fe0043145ec72b4ea66ac537392344”
}
}

Share the output returned by the last node

Information on your n8n setup

I’m on 1.100.1 cloud.
GitLab

It doesn’t look like the node support returning multiple files, try this instead

1 Like

Thanks @jabbson. This dies indeed solve the problem. I got a bit wrong footed assuming the built in n8n iteration would take care of this. Still not quite sure why it doesn’t in this case. Maybe a warning in this GitLab node would have helped.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.