N8n backup worflows to github

Bonjour à tous,

Je viens de découvrir n8n-io que je trouve très intéressant comme outil d’automatisation. J’ai commencé par créer de simples workflows et ensuite j’ai créé le workflow (template n8n) relatif aux backups sur Github des workflows n8n. Je suis arrivé à l’exécuter et mes workflows (fichiers JSON) ont bien été remontés sur Github. Le hic est que systématiquement le noeud isDiffOrNew (code Javascript) produit un état new sur lequel le noeud Github (create) créé de nouveau le fichier, d’où une erreur. L’analyse du code Javascript montre que la condition sur la recherche de l’attribut content issu du flux JSON de Github est toujours faux, car cet attribut n’existe pas dans le flux JSON remonté. De plus, les dates entre les 2 flux sont probablement pas totalement identiques, ce qui impacte le résultat de la comparaison dans ce code. Avez-vous rencontré ce dysfonctionnement et l’avez-vous corrigé?

Cordialement,

Hello everyone,

I have just discovered n8n-io which I find very interesting as an automation tool. I started by creating simple workflows and then I created the workflow (template n8n) relating to the backups on Github of the n8n workflows. I managed to run it and my workflows (JSON files) were successfully uploaded to Github. The problem is that the isDiffOrNew node (Javascript code) systematically produces a new state on which the Github node (create) creates the file again, resulting in an error. The analysis of the Javascript code shows that the condition on the search for the content attribute from the JSON feed from Github is always false, because this attribute does not exist in the uploaded JSON feed. Moreover, the dates between the 2 flows are probably not completely identical, which impacts the result of the comparison in this code. Have you encountered this malfunction and have you fixed it?

Cordially,

Hi @COPINE_Patrick

Welcome to the community!

Please post your questions in English. :slight_smile:

Hey @COPINE_Patrick,

I have been using that workflow for a while without issue, When you run it does it fail with an error message?

I have been using that workflow for a while without issue as well horewer recently it is trowing strange error on last item at node “isDiffOrNew”

ERROR: Unexpected end of JSON input [line 4]

Stack
SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at /usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Code:4:27
    at /usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Code:44:2
    at VM2 Wrapper.apply (/usr/local/lib/node_modules/n8n/node_modules/vm2/lib/bridge.js:485:11)
    at Sandbox.run (/usr/local/lib/node_modules/n8n/node_modules/vm2/lib/nodevm.js:426:23)
    at Sandbox.runCodeAllItems (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Code/Sandbox.js:36:42)
    at Sandbox.runCode (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Code/Sandbox.js:30:62)
    at Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Code/Code.node.js:75:39)
    at Workflow.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/Workflow.js:658:51)
    at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:590:68

Hey Jon,

During the first run of the workflow, the JSON files relating to the n8n workflows are created. During the second iteration without changing the content of the workflows, there is the following error message: ‘GitHub Create’ UNKNOWN ERROR - check detailed error for more information. Why content attribute does not exist in JSON file while it is searched in Javascript code?

Cordialy,

Hey @COPINE_Patrick,

That is odd I have just made a new Github repo to test with and I can’t reproduce the issue you are seeing.

Out of interest is this the workflow you are using?

Hey Jon,

The problem was related to the creation of the directory associated with the project. It had not been created with Git, but by the Create API linked to the workflow. Now it works. THANKS.

1 Like

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