Skip to content

DbGate does not work with MySql hosting integration #1103

@jakoss

Description

@jakoss

Describe the bug

Pretty vanilla setup:

<PackageVersion Include="Aspire.Hosting.MySql" Version="13.1.0" />
<PackageVersion Include="Aspire.MySqlConnector" Version="13.1.0" />
<PackageVersion Include="CommunityToolkit.Aspire.Hosting.MySql.Extensions" Version="13.1.0" />
var passwordResource = builder.AddParameter("password", "P@ssw0rd");
var database = builder.AddMySql("mysql-db", passwordResource, port: 12562)
    .WithContainerName("mysql-db-volume")
    .WithDbGate()
    .WithAdminer();

DbGate seems to get wrong connection string, here's the console log from DbGate resource:

{"pid":21,"caller":"connections","name":"serverConnection","connections":["mysql-db"],"level":40,"msg":"Invalid CONNECTIONS configutation, missing ENGINE for connection ID","time":1768482135538}

                                {"pid":21,"caller":"srvconnProcess","name":"serverConnection","errorMessage":"Could not get driver from connection {\"_id\":\"***\",\"useDatabaseUrl\":false,\"defaultDatabase\":null,\"singleDatabase\":false,\"databases\":null,\"useSeparateSchemas\":false,\"globalSettings\":\"***\"}","errorObject":{},"errorStack":"Error: Could not get driver from connection {\"_id\":\"***\",\"useDatabaseUrl\":false,\"defaultDatabase\":null,\"singleDatabase\":false,\"databases\":null,\"useSeparateSchemas\":false,\"globalSettings\":\"***\"}\n    at e.exports (/home/dbgate-docker/bundle.js:2:1320315)\n    at connect (/home/dbgate-docker/bundle.js:2:1255295)\n    at /home/dbgate-docker/bundle.js:2:1256270\n    at process.<anonymous> (/home/dbgate-docker/bundle.js:2:1256275)\n    at process.emit (node:events:514:28)\n    at emit (node:internal/child_process:937:14)\n    at process.processTicksAndRejections (node:internal/process/task_queues:83:21)","level":50,"msg":"Error processing message connect","time":1768482135553}

                                {"pid":1,"caller":"useController","name":"main","errorMessage":"Cannot read properties of null (reading 'passwordMode')","errorObject":{},"errorStack":"TypeError: Cannot read properties of null (reading 'passwordMode')\n    at Object.ensureOpened (/home/dbgate-docker/bundle.js:2:1207185)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n    at async Object.structure (/home/dbgate-docker/bundle.js:2:1213085)\n    at async /home/dbgate-docker/bundle.js:2:1324687","level":50,"msg":"Error when processing route /database-connections/structure","time":1768482144252}

Adminer with that setup works correctly

Regression

No response

Steps to reproduce

Use Aspire 13.1.0

<PackageVersion Include="Aspire.Hosting.MySql" Version="13.1.0" />
<PackageVersion Include="Aspire.MySqlConnector" Version="13.1.0" />
<PackageVersion Include="CommunityToolkit.Aspire.Hosting.MySql.Extensions" Version="13.1.0" />

and setup mysql with dbgate:

var passwordResource = builder.AddParameter("password", "P@ssw0rd");
var database = builder.AddMySql("mysql-db", passwordResource, port: 12562)
    .WithContainerName("mysql-db-volume")
    .WithDbGate()
    .WithAdminer();

Expected behavior

DbGate is correctly connected to the mysql database

Screenshots

Image

IDE and version

Rider

IDE version

No response

Nuget packages

Aspire.Hosting.MySql Version="13.1.0"
Aspire.MySqlConnector Version="13.1.0"
CommunityToolkit.Aspire.Hosting.MySql.Extensions Version="13.1.0"

Additional context

No response

Help us help you

Yes, but only if others can assist

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions