0

I'm trying to configure a Supabase wrapper to connect to my SQL Server database. After filling out the configuration form in Supabase and adding the columns for the table, I receive a 504 Gateway Timeout error when trying to view the table in the Supabase table editor.

Configuration Details:

Wrapper Name: nldourum

Connection String: Server=<IP_ADDRESS>,1433;User=<USER>;Password=<PASSWORD>;Database=<DB_NAME>;IntegratedSecurity=false;TrustServerCertificate=true;encrypt=false;ApplicationName=wrappers

Table and Schema Selection:

Microsoft SQL Server Table: dbo.ccusto Schema for the foreign table: public Table name: ccusto MSSQL Table: dbo.ccusto

Configured Columns:

Name: ccustoNumero, Type: text
Name: ccustoEmpresa, Type: text
Name: ccustoNome, Type: text
Name: ccustoTipocompra, Type: text
Name: ccustoTipodiverso, Type: text
Name: ccustoTipovenda, Type: text
Name: ccustoId, Type: bigint

SQL Server Query:

Using Microsoft SQL Server Management Studio (SSMS), I ran the following query and successfully retrieved data:

SELECT TOP (1000) [ccustoId]
      ,[ccustoNumero]
      ,[ccustoEmpresa]
      ,[ccustoNome]
      ,[ccustoTipocompra]
      ,[ccustoTipodiverso]
      ,[ccustoTipovenda]
  FROM [NLDourum].[dbo].[ccusto]

Error:

When trying to view the ccusto table in the Supabase table editor, I get the following error:

<html>
  <head><title>504 Gateway Time-out</title></head>
  <body>
    <center><h1>504 Gateway Time-out</h1></center>
  </body>
</html>

Question:

What could be causing the 504 Gateway Timeout error when trying to view the ccusto table in Supabase, and how can I resolve it?

Troubleshooting Steps Taken:

  1. Network Connectivity: Verified that the server hosting the Supabase instance can connect to the SQL Server (ping and telnet to port 1433 are successful).

  2. SQL Server Configuration:

Enabled remote connections in SQL Server. Verified that SQL Server Browser service is running. Ensured TCP/IP is enabled in SQL Server Configuration Manager.

  1. Timeout Settings:

Checked and adjusted timeout settings in SQL Server.

  1. SSL and Certificates:

Ensured TrustServerCertificate=true and correct SSL configurations.

  1. Test with Simple Connection:

Attempted to connect with a simpler table to rule out table-specific issues.

UPDATE 15/07/2024

  1. Tried to connect a Supabase project to another Supabase PostgreSQL database using postgres_fdw and it worked perfectly. This indicates that the issue is specific to the SQL Server connection.

  2. I also tried to connect to the SQL Server database using tds_fdw from a local PostgreSQL instance and it worked, confirming that my SQL Server database is functional. The issue seems to be related to the Supabase wrapper's ability to connect to the SQL Server.

Any suggestions or insights on resolving the connection issue with the Supabase wrapper would be greatly appreciated

3
  • 3. Timeout Settings: Checked and adjusted timeout settings in SQL Server. What timeout settings were those? If it was the "remote query timeout" that controls how long SQL Server waits when it's querying other data sources (e.g.: other Oracle servers, SQL servers, etc.). Commented Jul 10, 2024 at 12:17
  • Probably the 504 Gateway Timeout is coming from Supabase itself, it has a 150 second idle timeout. Ref: Limits Commented Jul 10, 2024 at 12:19
  • I tried to change the timeout in supabase and in SQL server, but was the same Commented Jul 10, 2024 at 18:30

1 Answer 1

0

Disable any CORS extension if installed.

I was facing the same problem, This was because of the "CORS" extension I had installed.

Sign up to request clarification or add additional context in comments.

1 Comment

I did not find any CORS police in my SQL Server, how can i do that?

Your Answer

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.