Bug report
Describe the bug
When running npx tsx seed.ts > supabase/seed.sql locally, the resulting seed.sql file contains a JavaScript object at the beginning that should not be present. This object appears to be a PostgreSQL warning/error object that's being written to stdout instead of stderr, corrupting the SQL file output.
The extraneous object at the beginning of the file is:
{
severity_local: 'WARNING',
severity: 'WARNING',
code: '42602',
message: 'invalid configuration parameter name "supautils.policy_grants", removing it',
detail: '"supautils" is now a reserved prefix.',
file: 'guc.c',
line: '9729',
routine: 'MarkGUCPrefixReserved'
}
This warning object is followed by valid SQL INSERT statements, but the presence of the JavaScript object at the top makes the seed.sql file invalid SQL and prevents it from being executed properly.
To Reproduce
Steps to reproduce the behavior:
- Set up a project with
@snaplet/seed v0.98.0
- Create a seed script (
seed.ts) that uses createSeedClient({ dryRun: true })
- Run the command:
npx tsx seed.ts > supabase/seed.sql
- Open the resulting
supabase/seed.sql file
- Observe the JavaScript warning object at the beginning of the file before the SQL statements
Expected behavior
The seed.sql file should contain only valid SQL statements. Any warnings, errors, or diagnostic messages from the seeding process should be written to stderr (not stdout), so they don't corrupt the redirected SQL output file.
Expected file should start directly with:
INSERT INTO public.organizations ...
Instead of having a JavaScript object before the SQL statements.
Screenshots
The first 10 lines of the corrupted seed.sql file:
{
severity_local: 'WARNING',
severity: 'WARNING',
code: '42602',
message: 'invalid configuration parameter name "supautils.policy_grants", removing it',
detail: '"supautils" is now a reserved prefix.',
file: 'guc.c',
line: '9729',
routine: 'MarkGUCPrefixReserved'
}
INSERT INTO public.organizations ...
System information
- OS: macOS 26.0.1 (Build 25A362)
- Node.js version: v24.10.0
- Version of @snaplet/seed: 0.98.0
- Database: Supabase (PostgreSQL)
Additional context
This issue is related to how @snaplet/seed handles PostgreSQL warnings/notices. The warning about supautils.policy_grants appears to be a legitimate PostgreSQL configuration warning, but it's being written to stdout where it contaminates the SQL output when using shell redirection.
The warning itself ("supautils" is now a reserved prefix) suggests this may be related to Supabase-specific extensions or configuration parameters that are no longer supported.
Workaround: Currently filtering the output to remove the first 10 lines after the content is generated would work, but this is fragile and shouldn't be necessary.
Impact: This prevents automated seeding workflows from functioning correctly, as the generated SQL file cannot be executed without manual editing to remove the JavaScript object.
Bug report
Describe the bug
When running
npx tsx seed.ts > supabase/seed.sqllocally, the resultingseed.sqlfile contains a JavaScript object at the beginning that should not be present. This object appears to be a PostgreSQL warning/error object that's being written to stdout instead of stderr, corrupting the SQL file output.The extraneous object at the beginning of the file is:
This warning object is followed by valid SQL INSERT statements, but the presence of the JavaScript object at the top makes the
seed.sqlfile invalid SQL and prevents it from being executed properly.To Reproduce
Steps to reproduce the behavior:
@snaplet/seedv0.98.0seed.ts) that usescreateSeedClient({ dryRun: true })npx tsx seed.ts > supabase/seed.sqlsupabase/seed.sqlfileExpected behavior
The
seed.sqlfile should contain only valid SQL statements. Any warnings, errors, or diagnostic messages from the seeding process should be written to stderr (not stdout), so they don't corrupt the redirected SQL output file.Expected file should start directly with:
Instead of having a JavaScript object before the SQL statements.
Screenshots
The first 10 lines of the corrupted
seed.sqlfile:{ severity_local: 'WARNING', severity: 'WARNING', code: '42602', message: 'invalid configuration parameter name "supautils.policy_grants", removing it', detail: '"supautils" is now a reserved prefix.', file: 'guc.c', line: '9729', routine: 'MarkGUCPrefixReserved' } INSERT INTO public.organizations ...System information
Additional context
This issue is related to how
@snaplet/seedhandles PostgreSQL warnings/notices. The warning aboutsupautils.policy_grantsappears to be a legitimate PostgreSQL configuration warning, but it's being written to stdout where it contaminates the SQL output when using shell redirection.The warning itself (
"supautils" is now a reserved prefix) suggests this may be related to Supabase-specific extensions or configuration parameters that are no longer supported.Workaround: Currently filtering the output to remove the first 10 lines after the content is generated would work, but this is fragile and shouldn't be necessary.
Impact: This prevents automated seeding workflows from functioning correctly, as the generated SQL file cannot be executed without manual editing to remove the JavaScript object.