supabase / postgrest-js

Isomorphic JavaScript client for PostgREST.
https://supabase.com
MIT License
1.04k stars 133 forks source link

Max content lenght for single-row inserts not defined #414

Open mansueli opened 1 year ago

mansueli commented 1 year ago

Bug report

To Reproduce

Set up:

  1. Create this table:
    create table saved_pages (
    id uuid not null primary key default uuid_generate_v4(),
    created_at timestamp with time zone default timezone('utc'::text, now()) not null,
    archived boolean not null default false,
    url text not null,
    html jsonb not null,
    title text not null,
    authors text not null,
    reading_time int,
    published_at timestamp
    );

  1. Go to https://www.youtube.com/watch?v=LVxL_p_kToc
  2. Define the variable: const data_html = JSON.stringify({ data: document.documentElement.innerHTML})
  3. Make the following call:
    
    const data_html `{"data":"<head>\x3Cscript data-original-src=\\"/s/player/ace4(....)`
    const table_data = {
    url: "http://example.org",
    html: JSON.stringify(data_html),
    title: "Test",
    authors: "Person",
    reading_time: 6,
    published_at: new Date().toISOString()
    }

const { data: response, error } = await supabase.from("saved_pages").insert(table_data, {count:null});


## Expected behavior
If it is not possible to use a JSON of roughly 5mb, then there should be a limitation specified in postgREST about this limitation.

## Screenshots

If applicable, add screenshots to help explain your problem.

## System information

- OS: macOS
- Version of supabase-js: 2.12.1
- Version of Node.js: v19.8.1

## Additional context
It is possible to insert these directly by changing the format to HTML and changing the raw format to accept HTML, but not possible to insert this as a JSONB object within a table. 
https://postgrest.org/en/stable/configuration.html?#raw-media-types