Supabase Connector: null values sent as empty strings ("") and new syntax error at or near "IF" issue

I’m encountering persistent issues with the Supabase connector that seem to stem from its handling of null values for text fields and, more recently, a new syntax error in the generated SQL.

Background: My ActivePieces flow extracts data, sanitizes it with a Custom JavaScript Code step (which converts empty strings into null JavaScript values), and then attempts to insert this data into a PostgreSQL table in Supabase. The PostgreSQL table has text columns that are nullable and use CHECK constraints for validation (e.g., email format, URL format).

Issue 1: null values from JavaScript are sent as empty strings ("") to Supabase. Despite my Custom JavaScript step explicitly outputting null for certain text fields (e.g., phone_number, culture_keywords, company_website_url), the Supabase connector consistently sends these as empty strings ("") in the request.body. This has led to CHECK constraint violations because PostgreSQL treats NULL and '' as distinct, and my constraints allowed NULL but not '' by default.

  • Evidence for Issue 1 (example with generic fields that can be empty):
    • My Custom JavaScript Output for these fields: JSON{ "phone_number": null, "culture_keywords": null, "company_website_url": null }
    • Supabase Action request.body for the same fields (what ActivePieces sends): JSON{ "phone_number": "", "culture_keywords": "", "company_website_url": "" }
    • Supabase Error Received (example of a constraint violation related to empty string): "message":"new row for relation \"company\" violates check constraint \"chk_company_example_url\"" "details":"Failing row contains (... , , ...)"
    • Workaround Applied: I have had to modify my Supabase CHECK constraints (e.g., for chk_company_email, chk_company_facebook_url) to explicitly allow ='', in addition to IS NULL or the regex pattern, to bypass this behavior. This is not ideal as it relaxes database-level data integrity for specific connector behavior.

Issue 2: New syntax error at or near "IF" when attempting Supabase insert. After applying the database constraint modifications, I am now encountering a more critical error for a recent test run. The Supabase connector is generating invalid SQL syntax.

  • Evidence for Issue 2:
    • Supabase Action request.body (example of a valid JSON payload as sent by ActivePieces, from a recent run): JSON{ "example_field_1": "Sample Text Data", "example_numeric_field": 123.45, "example_url_field": "https://www.example.com/test/", "example_nullable_field": "", "another_field": "More sample data" }
    • Supabase Error Received (from ActivePieces run log): JSON{ "response": { "status": 400, "body": { "code": "42601", "details": null, "hint": null, "message": "syntax error at or near \"IF\"" } }, "request": { "body": { // ... (the valid JSON payload as shown above) ... } } }
  • Problem: The request.body demonstrates a perfectly valid JSON object that should be accepted by Supabase’s API. The syntax error at or near "IF" suggests that the ActivePieces Supabase connector is improperly adding SQL keywords or control flow structures (like IF statements) around this JSON when constructing the final database query. This is a critical bug in the connector’s query generation.

Request for Assistance:

  1. For Issue 1 (null to empty string conversion): Could this behavior be addressed in the Supabase connector? The “Set as NULL” option in the mapping interface implies this should be possible.
  2. For Issue 2 (syntax error at or near "IF"): This is a critical bug preventing any data insertion. The connector seems to be generating invalid SQL around the JSON payload. Please investigate this as a high priority.

My ActivePieces flow currently cannot proceed due to these issues.