0

Bug report

Description

Content-Type not acceptable: application/json; charset=utf-8, code: PGRST102, details: Bad Request, hint: null (supabase flutter, self hosted)

Code:

createMessage() async {
try { 
 await supabase.from("chat_messages").insert({}); 
} catch (e) {
 print(e);
}}

Error:

I/flutter ( 3564): PostgrestException(message: Content-Type not acceptable: application/json; charset=utf-8, code: PGRST102, details: Bad Request, hint: null) I am using a self hosted instance of Supabase (Using the docker-compose.yml from supabase self hosted website).

Current Database Configuration:

(RLS disabled) | Name | Type | Default value | ----------- | ------------ | --------------- | id | int8 |
| created_at | timestamptz | now() | user_id | uuid | uid() | messages | json | NULL

Expected behavior

The same exact code works completely fine with no changes in the codebase except the uri and the anonkey but also the default value of user_id can be set to auth.uid() in case of the cloud hosted instance. This seems to change automatically in the self hosted instance when saving changes.

The intended use is to create a row with a message_id, created_at, user_id (which is the uid of the user who created the row) and messages (type json).

Cloud hosted database configuration:

(RLS disabled) | Name | Type | Default value | ----------- | ------------ | --------------- | id | int8 |
| created_at | timestamptz | now() | user_id | uuid | auth.uid() | messages | json | NULL

To Reproduce

Connect your project to a self hosted instance of supabase and connect your project. User authentication including account registration works flawlessly. But, adding a row throws this exact problem every single time.

System information

Development machine:

  • OS: Windows 11
  • Emulator Android version: 15
  • Version of supabse_flutter: 2.8.4

Homeserver Configuration:

  • Ubuntu 24.04.2 LTS
  • Self hosted using docker, script from https://supabase.com/docs/guides/self-hosting/docker
1
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. Commented Apr 27, 2025 at 12:28

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.