Bug: Wrong Content-Type #2436

Closed
opened 2026-03-13 09:54:10 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @rbalet on GitHub (Dec 1, 2025).

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

I'm using it inside an angular app

  1. Instantiate the authClient see provided Auth config
  2. Request for the eMail
this.authClient.sendVerificationEmail({ email });
  1. You'll get an 415 Unsupported Media Type

Current vs. Expected behavior

Current

Current is using the Content-Type: text/plain;charset=UTF-8
Image

Expected

While you should be using an application/json

Note

Not sure if this is due to the way angular works, but it shouldn't

What version of Better Auth are you using?

1.4.4

System info

{
  "system": {
    "platform": "darwin",
    "arch": "arm64",
    "version": "Darwin Kernel Version 24.6.0: Mon Jul 14 11:30:30 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T6020",
    "release": "24.6.0",
    "cpuCount": 12,
    "cpuModel": "Apple M2 Pro",
    "totalMemory": "32.00 GB",
    "freeMemory": "1.78 GB"
  },
  "node": {
    "version": "v24.11.1",
    "env": "development"
  },
  "packageManager": {
    "name": "npm",
    "version": "11.6.2"
  },
  "frameworks": null,
  "databases": null,
  "betterAuth": {
    "version": "1.4.4",
    "config": null
  }
}

Which area(s) are affected? (Select all that apply)

Client

Auth config (if applicable)

import { betterAuth } from "better-auth"
export const auth = createAuthClient({
    baseURL: this.#baseUrl + '/auth',
    fetchOptions: {
      mode: 'no-cors',
    },
    emailAndPassword: {
      enabled: true,
      requireEmailVerification: true,
    },
    plugins: [
      inferAdditionalFields({
        user: {
          language: {
            type: 'string',
          },
          incognito: {
            type: 'boolean',
          },
        },
      }),
    ],
  });

Additional context

can provide a Stackblitz if required

Originally created by @rbalet on GitHub (Dec 1, 2025). ### Is this suited for github? - [x] Yes, this is suited for github ### To Reproduce _I'm using it inside an angular app_ 1. Instantiate the authClient _see provided Auth config_ 2. Request for the eMail ``` this.authClient.sendVerificationEmail({ email }); ``` 3. You'll get an `415 Unsupported Media Type` ### Current vs. Expected behavior ## Current Current is using the `Content-Type: text/plain;charset=UTF-8` <img width="854" height="342" alt="Image" src="https://github.com/user-attachments/assets/86dadbc2-4fb9-4ea7-ac74-6a662680f39c" /> ## Expected While you should be using an `application/json` ## Note Not sure if this is due to the way angular works, but it shouldn't ### What version of Better Auth are you using? 1.4.4 ### System info ```bash { "system": { "platform": "darwin", "arch": "arm64", "version": "Darwin Kernel Version 24.6.0: Mon Jul 14 11:30:30 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T6020", "release": "24.6.0", "cpuCount": 12, "cpuModel": "Apple M2 Pro", "totalMemory": "32.00 GB", "freeMemory": "1.78 GB" }, "node": { "version": "v24.11.1", "env": "development" }, "packageManager": { "name": "npm", "version": "11.6.2" }, "frameworks": null, "databases": null, "betterAuth": { "version": "1.4.4", "config": null } } ``` ### Which area(s) are affected? (Select all that apply) Client ### Auth config (if applicable) ```typescript import { betterAuth } from "better-auth" export const auth = createAuthClient({ baseURL: this.#baseUrl + '/auth', fetchOptions: { mode: 'no-cors', }, emailAndPassword: { enabled: true, requireEmailVerification: true, }, plugins: [ inferAdditionalFields({ user: { language: { type: 'string', }, incognito: { type: 'boolean', }, }, }), ], }); ``` ### Additional context can provide a Stackblitz if required
GiteaMirror added the bug label 2026-03-13 09:54:10 -05:00
Author
Owner

@better-auth-agent[bot] commented on GitHub (Dec 1, 2025):

It looks like the issue might stem from using the fetch option "mode: 'no-cors'" in your authClient configuration. When no-cors is enabled, the browser imposes restrictions on the headers you can set, which can force the Content-Type to be sent as text/plain instead of application/json. For troubleshooting, try removing or adjusting the no-cors setting so that the request is correctly sent as JSON. Could you try that and let us know if it resolves the problem? Tag @better-auth-agent if you would like an answer from the Agent.

If you need more help, tag @Skyvern in a comment so I can respond.

DiagramDiscordGitHub

Diagram Join Star

@better-auth-agent[bot] commented on GitHub (Dec 1, 2025): It looks like the issue might stem from using the fetch option "mode: 'no-cors'" in your authClient configuration. When no-cors is enabled, the browser imposes restrictions on the headers you can set, which can force the Content-Type to be sent as text/plain instead of application/json. For troubleshooting, try removing or adjusting the no-cors setting so that the request is correctly sent as JSON. Could you try that and let us know if it resolves the problem? Tag @better-auth-agent if you would like an answer from the Agent. _If you need more help, tag @Skyvern in a comment so I can respond._ <!-- bot:webhook reply v1 --> [Diagram](https://repodiagrams.s3.eu-north-1.amazonaws.com/skyvern_ultra_detailed_interactive.html) • [Discord](https://discord.gg/fG2XXEuQX3) • [GitHub](https://github.com/Skyvern-AI/Skyvern) [![Diagram](https://img.shields.io/badge/Diagram-2b3137?style=flat-square)](https://repodiagrams.s3.eu-north-1.amazonaws.com/skyvern_ultra_detailed_interactive.html) [![Join](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&style=flat-square)](https://discord.gg/fG2XXEuQX3) [![Star](https://img.shields.io/badge/star-181717?logo=github&logoColor=white&style=flat-square)](https://github.com/Skyvern-AI/Skyvern)
Author
Owner

@rbalet commented on GitHub (Dec 1, 2025):

Seems to be effectively due to the CORS, closing the issue

@rbalet commented on GitHub (Dec 1, 2025): Seems to be effectively due to the CORS, closing the issue
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#2436