Do someone know what is hapenning here?

the base64 have 3mb size. Mybe this is the cause of the error. How do I do in this case to convert My base64 to file? Im trying to convert it so I can send it to supabase blob and get only the URL link, but even to convert the file im getting an error.

NodeOperationError: The value in "iVBORw0KGgoAAAANSUhEUgAABAAAAAYACAIAAABn4K39AADWAWNhQlgAANYBanVtYgAAAB5qdW1kYzJwYQARABCAAACqADibcQNjMnBhAAAANxNqdW1iAAAAR2p1bWRjMm1hABEAEIAAAKoA... ...OJtxA3VybjpjMnBhOmNlYWI2YzMzLTZhYjYtNDE1ZS1iZTQ2LWYxZTI5AASUVORK5CYII=" is not set at ExecuteContext.createBinaryFromJson (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/utils/binary.js:83:11) at ExecuteContext.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Files/ConvertToFile/actions/toBinary.operation.js:141:67) at ExecuteContext.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Files/ConvertToFile/ConvertToFile.node.js:143:43) at WorkflowExecute.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/execution-engine/workflow-execute.js:681:50) at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/execution-engine/workflow-execute.js:915:62 at processTicksAndRejections (node:internal/process/task_queues:95:5) at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/execution-engine/workflow-execute.js:1246:20

Information on your n8n setup

  • **n8n version 1.92
  • **Database: Postgres
  • **n8n EXECUTIONS_PROCESS setting: own
  • **Running n8n via Docker
  • **Operating system: Linux Ubuntu

I got the solution from it by myself doing a Code node with the script below:

// Access the first input item
const item = $input.first();

// Retrieve the Base64 string from the JSON data
const base64String = item.json.image

// Remove any data URL prefix if present
const cleanedBase64 = base64String.replace(/^data:.*;base64,/, '');

// Decode the Base64 string into a Buffer
const buffer = Buffer.from(cleanedBase64, 'base64');

// Prepare the binary data using n8n's helper function
const binaryData = await this.helpers.prepareBinaryData(buffer, 'output.jpg'); // Replace 'output.pdf' with your desired filename

// Return the binary data
return {
  json: {},
  binary: {
    data: binaryData
  }
};

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