Uploading a JSON File to S3 not setting the correct Content Type

Uploading JSON output data to S3 is not setting the correct content type (application/json) in S3, instead setting the content type as “text/HTML”

What is the error message (if any)?

Ganesh workflow

Share the output returned by the last node

Information on your n8n setup

  • n8n version:
  • Database you’re using (default: SQLite):
  • Running n8n with the execution process [own(default), main]:
  • Running n8n via [Docker, npm, n8n.cloud, desktop app]:

Hi @Siva_Manickam, welcome to the community!

I just tried uploading a generic JSON file to a minio instance like so:

docker-compose.yml
version: '3'

services:
  minio:
    image: minio/minio:latest
    ports:
      - "9000:9000"
      - "9001:9001"
    volumes:
      - ./minio_storage:/data
    environment:
      MINIO_ROOT_USER: test123456
      MINIO_ROOT_PASSWORD: test123456
    command: server --console-address ":9001" /data
  n8n:
    image: n8nio/n8n:latest
    ports:
      - "5678:5678"
    volumes:
      - ./n8n:/home/node/.n8n

Minio confirm the correct content type:

Is there a chance you simple didn’t enable the “Binary Data” toggle on the S3 node?

The node wouldn’t upload data from the file system directly, so if that’s what you have in mind you’d need to read from the file system first (using the Read Binary Files node).

Thanks for your response. Enabling the “Binary Data” toggle on the S3 Node returns an error " No binary data exists on item!"

Here is the code and the file that I’m trying to upload to S3

Here is the file that I’m trying to upload to S3.

[{
		"data": "SKU1234",
		"Desc": "Ganesh",
		"Name ": "Name Desc",
		"Test": "Test fast",
		"Test 2": "Test Test 2",
		"Test 3": "Test Test 3"
	},
	{
		"data": "SKU1235",
		"Desc": "Ganesh test2",
		"Name ": "Name Desc2",
		"Test": "Test fas1t",
		"Test 2": "Test Test 2",
		"Test 3": "Test Test 3"
	}
]

Can you please simulate the error & let me know the right fix to resolve this issue?

Appreciate the timely help

Regards
Siva Manickam

Cheers @Siva_Manickam

Seeing you have plain JSON data you probably want to create a binary item with the required properties using the Move Binary Data node before uploading it to S3. For example like so:

The Move Binary Data node lets you specify properties such as the MIME Type:

It generates binary data which you can then upload to S3 as expected. Hope this helps!

1 Like

This helps, please close the issue

2 Likes

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