Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Can't connect to Postgres #366

Open
heidrje-SICKAG opened this issue Feb 19, 2025 · 0 comments
Open

[Bug]: Can't connect to Postgres #366

heidrje-SICKAG opened this issue Feb 19, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@heidrje-SICKAG
Copy link

Contact Details

jens.heidrich@sick.de

Describe the bug

If I want to start the AASX Server with Postgres DB support, the server does not start because its trying to use SQLITE as database. The connection string on the other hand gets picked up correctly.

Log output

aasx-server  | Use SQLITE
aasx-server  | Database connection string: Host=db;Port=5432;Database=AAS;Username=snip;Password=snap
aasx-server  | Unable to connect to the database.

To reproduce

Start AASX Server with DB support and a Postgres Connection String.

Screenshots

Expected Behaviour

AAS server should connect to Postgres DB and use it.

Version

main

Operating System

Docker

Relevant log output

aasx-server  | Loading Configuration in path: /AasxServerBlazor
aasx-server  | BuildHost with Microsoft.Extensions.Configuration.ConfigurationRoot
aasx-server  | warn: Microsoft.AspNetCore.DataProtection.Repositories.FileSystemXmlRepository[60]
aasx-server  |       Storing keys in a directory '/root/.aspnet/DataProtection-Keys' that may not be persisted outside of the container. Protected data will be unavailable when container is destroyed. For more information go to https://aka.ms/aspnet/dataprotectionwarning
aasx-server  | info: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[62]
aasx-server  |       User profile is available. Using '/root/.aspnet/DataProtection-Keys' as key repository; keys will not be encrypted at rest.
aasx-server  | info: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[58]
aasx-server  |       Creating key {ad77bafd-e3ff-47d4-98ab-c65a9d39148c} with creation date 2025-02-19 10:01:40Z, activation date 2025-02-19 10:01:40Z, and expiration date 2025-05-20 10:01:40Z.
aasx-server  | warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35]
aasx-server  |       No XML encryptor configured. Key {ad77bafd-e3ff-47d4-98ab-c65a9d39148c} may be persisted to storage in unencrypted form.
aasx-server  | info: Microsoft.AspNetCore.DataProtection.Repositories.FileSystemXmlRepository[39]
aasx-server  |       Writing data to file '/root/.aspnet/DataProtection-Keys/key-ad77bafd-e3ff-47d4-98ab-c65a9d39148c.xml'.
aasx-server  | warn: Microsoft.AspNetCore.Hosting.Diagnostics[15]
aasx-server  |       Overriding HTTP_PORTS '5001' and HTTPS_PORTS ''. Binding to values defined by URLS instead 'http://*:5001'.
aasx-server  | warn: Microsoft.AspNetCore.Server.Kestrel[0]
aasx-server  |       Overriding address(es) 'http://*:5001'. Binding to endpoints defined via IConfiguration and/or UseKestrel() instead.
aasx-server  | info: Microsoft.Hosting.Lifetime[14]
aasx-server  |       Now listening on: http://[::]:5001
aasx-server  | info: Microsoft.Hosting.Lifetime[0]
aasx-server  |       Application started. Press Ctrl+C to shut down.
aasx-server  | info: Microsoft.Hosting.Lifetime[0]
aasx-server  |       Hosting environment: Production
aasx-server  | info: Microsoft.Hosting.Lifetime[0]
aasx-server  |       Content root path: /AasxServerBlazor
aasx-server  | InitializeProgram
aasx-server  | args:
aasx-server  | --data-path
aasx-server  | /usr/share/aasxs
aasx-server  | --external-blazor
aasx-server  | https://aasx.dev-cloud.sick.com
aasx-server  | --edit
aasx-server  | --save-temp
aasx-server  | 30
aasx-server  | --no-security
aasx-server  | --with-db
aasx-server  | --aasx-in-memory
aasx-server  | 100
aasx-server  | --start-index
aasx-server  | 44000
aasx-server  |
aasx-server  | Variable: WITHPOLICY = false
aasx-server  | withPolicy: False
aasx-server  | Serving the AASXs from: /usr/share/aasxs
aasx-server  | Security 1 Startup - Server
aasx-server  | Security 1.1 Load X509 Root Certificates into X509 Store Root
aasx-server  | Use SQLITE
aasx-server  | Database connection string: Host=db;Port=5432;Database=AAS;Username=snip;Password=snap
aasx-server  | Unable to connect to the database.
aasx-server  | Unhandled exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
aasx-server  |  ---> System.AggregateException: One or more errors occurred. (Migration failed: Connection string keyword 'host' is not supported. For a possible alternative, see https://go.microsoft.com/fwlink/?linkid=2142181.
aasx-server  | Try deleting the database.)
aasx-server  |  ---> System.Exception: Migration failed: Connection string keyword 'host' is not supported. For a possible alternative, see https://go.microsoft.com/fwlink/?linkid=2142181.
aasx-server  | Try deleting the database.
aasx-server  |    at AasxServerDB.AasContext.InitDB(Boolean reloadDB, String dataPath) in /repo/src/AasxServerDB/EntityFW.cs:line 139
aasx-server  |    at AasxServer.Program.Run(CommandLineArguments a) in /repo/src/AasxServerStandardBib/Program.cs:line 760
aasx-server  |    --- End of inner exception stack trace ---
aasx-server  |    at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
aasx-server  |    at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
aasx-server  |    at System.Threading.Tasks.Task.Wait()
aasx-server  |    at AasxServer.Program.<>c.<Main>b__64_0(CommandLineArguments a) in /repo/src/AasxServerStandardBib/Program.cs:line 1234
aasx-server  |    at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
aasx-server  |    at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span`1 copyOfArgs, BindingFlags invokeAttr)
aasx-server  |    --- End of inner exception stack trace ---
aasx-server  |    at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span`1 copyOfArgs, BindingFlags invokeAttr)
aasx-server  |    at System.Reflection.MethodBaseInvoker.InvokeWithOneArg(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
aasx-server  |    at System.Delegate.DynamicInvokeImpl(Object[] args)
aasx-server  |    at System.CommandLine.Invocation.ModelBindingCommandHandler.InvokeAsync(InvocationContext context)
aasx-server  |    at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<<BuildInvocationChain>b__0>d.MoveNext()
aasx-server  | --- End of stack trace from previous location ---
aasx-server  |    at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseParseErrorReporting>b__21_0>d.MoveNext()
aasx-server  | --- End of stack trace from previous location ---
aasx-server  |    at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass16_0.<<UseHelp>b__0>d.MoveNext()
aasx-server  | --- End of stack trace from previous location ---
aasx-server  |    at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass25_0.<<UseVersionOption>b__0>d.MoveNext()
aasx-server  | --- End of stack trace from previous location ---
aasx-server  |    at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass23_0.<<UseTypoCorrections>b__0>d.MoveNext()
aasx-server  | --- End of stack trace from previous location ---
aasx-server  |    at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseSuggestDirective>b__22_0>d.MoveNext()
aasx-server  | --- End of stack trace from previous location ---
aasx-server  |    at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseParseDirective>b__20_0>d.MoveNext()
aasx-server  | --- End of stack trace from previous location ---
aasx-server  |    at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseDebugDirective>b__11_0>d.MoveNext()
aasx-server  | --- End of stack trace from previous location ---
aasx-server  |    at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<RegisterWithDotnetSuggest>b__10_0>d.MoveNext()
aasx-server  | --- End of stack trace from previous location ---
aasx-server  |    at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass14_0.<<UseExceptionHandler>b__0>d.MoveNext()
@heidrje-SICKAG heidrje-SICKAG added the bug Something isn't working label Feb 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant