Skip to content

Failed to upload file with status 415 (Unsupported Media Type)Β #45

@vzt7

Description

@vzt7

Hi, I'd like to use better-auth-cloudflare with R2 bucket, but I got an error when uploading a file:

{"code": "UNSUPPORTED_MEDIA_TYPE", "message": "Content-Type is required. Allowed types: application/json", "status": 415, "statusText": "unsupported media type"}

Found the cause

A change related to allowedMediaTypes was introduced in [email protected].

Reference to the changes in better-auth: Commit 1412892

So we should add a metadata.allowedMediaTypes field on src/r2.ts#L519

How to resolve

Add the metadata.allowedMediaTypes field based on the r2.allowedTypes config field of better-auth-cloudflare.

I created a patch for this, see https://gist.github.com/vzt7/ce0b87972e56ab0cf4578a50c0aa3849

If this looks good, I'm glad to submit a PR

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions