Request failed with status code 413 when converting json to file


I am querying API, which returns a PDF. However, the API is not correct as it returns mime type application/json.
To fix that, I am using a custom code.

It was working in 1.20, but not 1.30 anymore.

What is the error message (if any)?

Problem running workflow

Request failed with status code 413

Please share your workflow

Share the output returned by the last node

Information on your n8n setup

  • n8n version: 1.31
  • Database (default: SQLite): postgres
  • n8n EXECUTIONS_PROCESS setting (default: own, main): main
  • Running n8n via (Docker, npm, n8n cloud, desktop app): k8s
  • Operating system:

413 would mean that the generated JSON for the workflow that gets sent to /rest/workflow/run is larger than 16MB.
Do you have env variable N8N_DEFAULT_BINARY_DATA_MODE set to filesystem? if not, I’d recommend trying that.

1 Like

This works, thank you. One question thou. We are using an ephemeral storage. So once n8n restart data isn’t there. I don’t see a problem with that, as the data is in transit here. And we are not plan to store data locally in general.

Are there any other issues or issues we might see as a side effect? For example, History?

This setting only affects binary data created during executions. With ephemeral storage the only risk is that someone looking at an old executions might not be able to view/download the binary data, once those files are gone.
Since you are using Kubernetes, I’d recommend creating a PVC like this:

apiVersion: v1
kind: PersistentVolumeClaim
  namespace: n8n
  name: n8n-binary-data-pvc
    - ReadWriteOnce
      storage: 2Gi

and then mount the volume into the n8n container:

        - name: n8n
          image: n8n-io/n8n
          - name: n8n-binary-data
            mountPath: /home/node/.n8n/binaryData
      - name: n8n-binary-data
          claimName: n8n-binary-data-pvc

also, please don’t use this in queue-mode.

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