RestoreCredential

Restore credential

Overview

This node, named "RestoreCredential," is designed to restore credentials in an n8n environment by importing them from binary input data. It reads credential data provided as a binary field, writes it to a JSON file, and then executes a command-line instruction to import these credentials into n8n. This node is useful when migrating or restoring credentials from backups or external sources.

Practical examples include:

  • Restoring saved credentials after an n8n instance reset or migration.
  • Automating the process of importing credentials from backup files stored externally.
  • Integrating credential restoration into workflow automation for seamless environment setup.

Properties

Name Meaning
Input Binary Field The name of the binary field containing the credential data to be restored (default: "data").

Output

The node outputs an empty JSON object ({}) indicating completion. It does not produce any meaningful JSON data or binary output itself. Its primary function is side-effect based (writing a file and executing a system command).

Dependencies

  • Requires access to the local filesystem to write a temporary JSON file named rs_credentials.json.
  • Uses the Node.js child_process module to synchronously execute the CLI command n8n import:credentials --input=rs_credentials.json.
  • Assumes that the n8n CLI is installed and accessible in the environment where this node runs.
  • Requires appropriate permissions to execute shell commands and write files on the host system.

Troubleshooting

  • Common issues:

    • If the binary input field does not contain valid JSON or expected structure, the node may fail to write the correct file or throw parsing errors.
    • Lack of permission to write files or execute shell commands will cause the node to fail.
    • The n8n import:credentials CLI command must be available; otherwise, the execution will error out.
  • Error messages and resolutions:

    • JSON parsing errors: Ensure the binary input contains properly formatted JSON with the expected structure.
    • File write errors: Verify that the node has write permissions in the working directory.
    • Command execution errors: Confirm that the n8n CLI is installed and accessible in the system PATH.
    • Empty or incorrect input: Check that the specified binary field name matches the actual input data field.

Links and References

Discussion