SQL Database Connector suddenly not working

I have a SQL database hosted in Azure that’s connected to my application. There have been no updates on my Bubble app or the database and suddenly workflows / queries are failing.

When I run this query directly on my database, it works.

How many records are you trying to return? (edit: Oh interesting you see it says there is an unexpected token ‘?’. Is there a question mark somewhere in the query? I am assuming not so it seems strange that is the error.)

Is there any way we can update our DB connector plugin? It feels like an issue within there.
Also another relevant github issue: https://github.com/tediousjs/node-mssql/issues/1432

I did see that as well and Bubble just mentioned they are working on upgrading the node architecture for plugins so it could be related. Which plugin are you using?

1 Like

It seems to be an issue with the plugin and not the query, the same query ran fine when I ran it against the DB directly.

Here’s the console.log error on the app:

 Plugin action SQL Query with Return error: 
/var/task/node_modules/mssql/lib/tedious/connection-pool.js:39
  cfg.options.connectTimeout = cfg.options.connectTimeout ?? this.config.connectionTimeout ?? this.config.timeout ?? 15000
                                                           ^

SyntaxError: Unexpected token '?'
at wrapSafe (internal/modules/cjs/loader.js:915:16)
at Module._compile (internal/modules/cjs/loader.js:963:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (/var/task/node_modules/mssql/lib/tedious/index.js:4:24)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)

Yep I think that is the issue. This plugin is Bubble’s “SQL Database Connect” which uses tedious-mssql under the hood. If Bubble is upgrading their node architecture then this NPM package / version would break as it’s using a Node 14 syntax '?? ’ which is deprecated in Node 16. Not sure how to resolve this.

Hey this update broke our plugin as well. We quickly patched it up with a new command “MSSQL Command”. It isn’t a free plugin like Bubble’s but it might help you get you back up and running until a patch is pushed out (plus it has some other cool features). Feel free to give us a shout if you end up using it and find any issues.

It was in fact the issue noted above from github.

Documentation here (slightly outdated now): Introduction - SQL Database Connector Pro

Thanks @ben13 - so just to be clear we would essentially need to rewrite all of our SQL Queries with the “MSSQL Command” correct?

Additionally, how does the “Bulk Data” field work?
I don’t see that in the docs you provided.

I only ask because I’m getting a slightly different but ultimately similar error when using the “MSSQL Command”

@bubble.trouble - Do you know if it’s possible to escalate the request to patch the “SQL Database Connect” plugin to fix this?

Scratch that - was able to get past that latest unexpected token issue by trying again from scratch for that specific query.

Would still like to see if we can get this fixed at the plugin level though.

I’ll bet u dollars to donuts those nitwits broke things. I’m corresponding with someone who uses List Popper and one day things are working fine and the next, nothing appears at LP’s outputs. The only thing can cause that is a problem IN THE ENVIRONMENT, not the code. Say it with me, “eff you you effing pikers.”

1 Like

How you resolve this is file a bug report and tell the Bubble team they’re a bunch of amateurs.

But also… why would node 16 deprecate the nullish coalescing operator? That seems dumb. But dumber would be Bubble changing node environments without evaluating the impact properly.

Glad you were able to get the query working!

The Bulk Data/Insert is a prototype feature that allows you to move large amounts of data from Bubble to SQL Server. It is still in the testing phase which is why it isn’t fully documented but if you have such a need I am happy to provide you with more details

Is the SQL Server hosted on Azure? If yes, did you use SQL Database Connector to make the connection? I’m having trouble establishing the connection:

DB Connector
Connection issue: SQL Database Connector issue: Connection attempt
failed: Cannot open server ‘cbti’ requested by the login. Client with IP
address ‘54.202.220.99’ is not allowed to access the server. To enable
access, use the Windows Azure Management Portal or run
sp_set_firewall_rule on the master database to create a firewall rule
for this IP address or address range. It may take up to five minutes
for this change to take effect.
GOT IT

Is there any solution for this case?

1 Like

@claubaccaro Did you setup your firewall rule as desribed here: Configure SQL Connector - SQL Database Connector Pro

1 Like

Working perfect! Thanks!

Glad it worked. And I highly recommend… our SQL plugin!!! :slight_smile: (should the need arise)