Identityserver4.admin: release/2.0.0: IdentityClaims table is missing

Created on 16 Feb 2021  路  8Comments  路  Source: skoruba/IdentityServer4.Admin

Describe the bug

I'm attempting to run release/2.0.0 (91f1011742134808c3149cb9a2e380b49d3820f0) on docker.

After all services are up I can log in to STS with the provided default credentials of identitydata.json. Requesting /.well-known/openid-configuration fails with an exception because a table is missing.

Relevant parts of the log file

It seems that the tables was removed as part during that startup of the "admin" container:

$ docker logs identity-server_admin_1 | \grep IdentityClaims
[2021-02-16T14:27:42.0885401+00:00][INFO][14][Microsoft.EntityFrameworkCore.Database.Command] Executed DbCommand ("11"ms) [Parameters=[""], CommandType='Text', CommandTimeout='30']"\n""CREATE TABLE [IdentityClaims] (\n    [Id] int NOT NULL IDENTITY,\n    [Type] nvarchar(200) NOT NULL,\n    [IdentityResourceId] int NOT NULL,\n    CONSTRAINT [PK_IdentityClaims] PRIMARY KEY ([Id]),\n    CONSTRAINT [FK_IdentityClaims_IdentityResources_IdentityResourceId] FOREIGN KEY ([IdentityResourceId]) REFERENCES [IdentityResources] ([Id]) ON DELETE CASCADE\n);"
[2021-02-16T14:27:42.1499508+00:00][INFO][13][Microsoft.EntityFrameworkCore.Database.Command] Executed DbCommand ("3"ms) [Parameters=[""], CommandType='Text', CommandTimeout='30']"\n""CREATE INDEX [IX_IdentityClaims_IdentityResourceId] ON [IdentityClaims] ([IdentityResourceId]);"
[2021-02-16T14:27:43.0981068+00:00][INFO][13][Microsoft.EntityFrameworkCore.Database.Command] Executed DbCommand ("8"ms) [Parameters=[""], CommandType='Text', CommandTimeout='30']"\n""INSERT INTO IdentityResourceClaims\n (Id, [Type], IdentityResourceId)\nSELECT \n Id, [Type], IdentityResourceId\nFROM IdentityClaims"

# DROP TABLE follows:

[2021-02-16T14:27:43.1351639+00:00][INFO][14][Microsoft.EntityFrameworkCore.Database.Command] Executed DbCommand ("4"ms) [Parameters=[""], CommandType='Text', CommandTimeout='30']"\n""DROP TABLE [IdentityClaims];"

The following exception is logged on the request for /.well-known/openid-configuration.

Microsoft.Data.SqlClient.SqlException (0x80131904): Invalid object name 'IdentityClaims'.
   at Microsoft.Data.SqlClient.SqlCommand.<>c.<ExecuteDbDataReaderAsync>b__164_0(Task`1 result)
   at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
   at System.Threading.Tasks.Task.<>c.<.cctor>b__274_0(Object obj)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable`1.AsyncEnumerator.InitializeReaderAsync(DbContext _, Boolean result, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func`4 operation, Func`4 verifySucceeded, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable`1.AsyncEnumerator.MoveNextAsync()
   at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.ToListAsync[TSource](IQueryable`1 source, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.ToListAsync[TSource](IQueryable`1 source, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.ToArrayAsync[TSource](IQueryable`1 source, CancellationToken cancellationToken)
   at IdentityServer4.EntityFramework.Stores.ResourceStore.GetAllResourcesAsync()
   at IdentityServer4.Stores.IResourceStoreExtensions.GetAllEnabledResourcesAsync(IResourceStore store)
   at IdentityServer4.ResponseHandling.DiscoveryResponseGenerator.CreateDiscoveryDocumentAsync(String baseUrl, String issuerUri)
   at IdentityServer4.Endpoints.DiscoveryEndpoint.ProcessAsync(HttpContext context)
   at IdentityServer4.Hosting.IdentityServerMiddleware.Invoke(HttpContext context, IEndpointRouter router, IUserSession session, IEventService events)
   at IdentityServer4.Hosting.IdentityServerMiddleware.Invoke(HttpContext context, IEndpointRouter router, IUserSession session, IEventService events)
   at IdentityServer4.Hosting.MutualTlsTokenEndpointMiddleware.Invoke(HttpContext context, IAuthenticationSchemeProvider schemes)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at IdentityServer4.Hosting.BaseUrlMiddleware.Invoke(HttpContext context)
   at NWebsec.AspNetCore.Middleware.Middleware.CspMiddleware.Invoke(HttpContext context)
   at NWebsec.AspNetCore.Middleware.Middleware.MiddlewareBase.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
ClientConnectionId:26bafdb5-75cb-4014-819a-6ef6117d0c87
Error Number:208,State:1,Class:16
bug report

All 8 comments

Hello,
which database provider do you use? Did you have an empty database before starting?
thanks for reporting this issue

Hello Jan,

SQL Server 2019 on docker. I started without any data.

Let me know if you need further details.

Alex

Thanks let me check it.

@agross - I've refresh dockerfile for admin ui there was missing one package. I've tested new fresh instalation through the docker and everything works good. 馃憤 One thing is that if the database starts for the first time this process takes more time and first run failed because the database is not ready yet. Please, checkout changes from release/2.0.0 and test it. 馃槉
Thanks

Tried after resetting all docker volumes. It's working now!

What's rather strange is that the IdentityClaims table is still missing. Is it required after all for version 2.0?

IdentityClaims table was renamed in IS4 v4 to IdentityResourceClaims.

Alright, thanks!

Thanks for letting me know. 馃憢

Was this page helpful?
0 / 5 - 0 ratings

Related issues

knepe picture knepe  路  4Comments

yehia2amer picture yehia2amer  路  3Comments

Hens94 picture Hens94  路  4Comments

skoruba picture skoruba  路  4Comments

we4sz picture we4sz  路  4Comments