singlestoredb-laravel-driver: Vapor Serverless - Laravel can't find singlestore driver

Hi,

The singlestore driver seems incompatible with Vapor.

From a middleware where we do this : auth()->check() === false

Here is the error received :

PDOException
Illuminate\Database\QueryException
SQLSTATE[HY000] [2002]  (trying to connect via (null)) (SQL: select * from `user` where `id` = 1024732 limit 1)

Even trying to register singlestore connection in the AppServiceProvider following this issue : https://github.com/singlestore-labs/singlestore-laravel-driver/issues/2 it does not work

Maybe an extension is missing on Vapor but which one? Is there an incompatibility with Alpine?

On EC2 it works but not on serverless 😦.

Any idea?

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 2
  • Comments: 21 (7 by maintainers)

Most upvoted comments

Interesting!


I was going to ask if you guys are adding the singlestore_bundle.pem certificate in your codebases, since I had similar issues when I first started using the package and all I was missing was the certificate. I just remembered that and I don’t remember talking about it in any other issue here in GitHub 🤔 , @aarondfrancis I’ll see if I can draft a PR about it this week.

This is what we do:

In our database.php config file:

'options' => extension_loaded('pdo_mysql') ? array_filter([
    /**
     * For staging and production environments we use a managed SingleStore
     * cluster that expects us to trust this certificate.
     */
    PDO::MYSQL_ATTR_SSL_CA => env('APP_ENV') !== 'testing' && env('APP_ENV') !== 'local' ? database_path('singlestore_bundle.pem') : false,
    PDO::ATTR_EMULATE_PREPARES => true,
]) : [],

And then the certificate in database/singlestore_bundle.pem

Super bizarre. I’ll spin up a new vapor app and try it on Tuesday, let me know if y’all figure anything else out before then! Sorry for the weirdness

Hey @aarondfrancis,

Exact same issue here, just keep getting this: SQLSTATE[HY000] [2002] (trying to connect via (null))

Been spinning my wheels on this for a few hours but narrowed it down to the singlestore driver, the moment you add it, it breaks the database in any vapor deployment

Yep worked for me too! Thank you!

I couldn’t resist and had to test. It’s the certificate, it fixed it. Thank you!

Will try in the morning and let you know, thanks for the suggestion