Open Closed

Product entity does not load on microservice template #5205


User avatar
0
epeters created

Hello.

When trying to use the product part of the microservice template, I get the following error:

There has been no custom code added here.


7 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Please share the error logs; thanks.

  • User Avatar
    0
    epeters created

    Which log file should I be looking at for an error on: http://localhost:4200/product-service/product ?

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    The gateway and product service.

  • User Avatar
    0
    epeters created

    Gateway:

    2023-06-07 08:00:15.520 -05:00 [INF] Request finished HTTP/1.1 GET https://localhost:44325/api/abp/application-localization?cultureName=en&onlyDynamics=false - - - 200 62495 application/json;+charset=utf-8 810.7639ms 2023-06-07 08:01:42.638 -05:00 [INF] Request starting HTTP/1.1 OPTIONS https://localhost:44325/api/product-service/products?skipCount=0&maxResultCount=10 - - 2023-06-07 08:01:42.639 -05:00 [INF] CORS policy execution successful. 2023-06-07 08:01:42.639 -05:00 [INF] Request finished HTTP/1.1 OPTIONS https://localhost:44325/api/product-service/products?skipCount=0&maxResultCount=10 - - - 204 - - 0.6832ms 2023-06-07 08:01:42.644 -05:00 [INF] Request starting HTTP/1.1 GET https://localhost:44325/api/product-service/products?skipCount=0&maxResultCount=10 - - 2023-06-07 08:01:42.644 -05:00 [INF] CORS policy execution successful. 2023-06-07 08:01:42.644 -05:00 [DBG] requestId: 0HMR7ARR0ARKP:00000002, previousRequestId: no previous request id, message: ocelot pipeline started 2023-06-07 08:01:42.644 -05:00 [DBG] requestId: 0HMR7ARR0ARKP:00000002, previousRequestId: no previous request id, message: Upstream url path is /api/product-service/products 2023-06-07 08:01:42.645 -05:00 [DBG] requestId: 0HMR7ARR0ARKP:00000002, previousRequestId: no previous request id, message: downstream templates are /api/product-service/{everything} 2023-06-07 08:01:42.645 -05:00 [INF] requestId: 0HMR7ARR0ARKP:00000002, previousRequestId: no previous request id, message: EndpointRateLimiting is not enabled for /api/product-service/{everything} 2023-06-07 08:01:42.645 -05:00 [INF] requestId: 0HMR7ARR0ARKP:00000002, previousRequestId: no previous request id, message: No authentication needed for /api/product-service/products 2023-06-07 08:01:42.645 -05:00 [INF] requestId: 0HMR7ARR0ARKP:00000002, previousRequestId: no previous request id, message: /api/product-service/{everything} route does not require user to be authorized 2023-06-07 08:01:42.645 -05:00 [DBG] requestId: 0HMR7ARR0ARKP:00000002, previousRequestId: no previous request id, message: Downstream url is https://localhost:44361/api/product-service/products?skipCount=0&maxResultCount=10 2023-06-07 08:01:43.591 -05:00 [WRN] requestId: 0HMR7ARR0ARKP:00000002, previousRequestId: no previous request id, message: 500 (Internal Server Error) status code, request uri: https://localhost:44361/api/product-service/products?skipCount=0&maxResultCount=10 2023-06-07 08:01:43.591 -05:00 [DBG] requestId: 0HMR7ARR0ARKP:00000002, previousRequestId: no previous request id, message: setting http response message 2023-06-07 08:01:43.591 -05:00 [DBG] requestId: 0HMR7ARR0ARKP:00000002, previousRequestId: no previous request id, message: no pipeline errors, setting and returning completed response 2023-06-07 08:01:43.591 -05:00 [DBG] requestId: 0HMR7ARR0ARKP:00000002, previousRequestId: no previous request id, message: ocelot pipeline finished 2023-06-07 08:01:43.591 -05:00 [INF] Request finished HTTP/1.1 GET https://localhost:44325/api/product-service/products?skipCount=0&maxResultCount=10 - - - 500 331 application/json;+charset=utf-8 947.3412ms

  • User Avatar
    0
    epeters created

    Product Service:

    2023-06-07 08:01:42.728 -05:00 [INF] Request starting HTTP/1.1 GET https://localhost:44361/api/product-service/products?skipCount=0&maxResultCount=10 - 0 2023-06-07 08:01:42.749 -05:00 [INF] CORS policy execution failed. 2023-06-07 08:01:42.750 -05:00 [INF] Request origin http://localhost:4200 does not have permission to access the resource. 2023-06-07 08:01:42.993 -05:00 [INF] Executing endpoint 'CarePlus.ProductService.Products.ProductController.GetListAsync (CarePlus.ProductService.HttpApi)' 2023-06-07 08:01:43.000 -05:00 [INF] Route matched with {area = "productService", action = "GetList", controller = "Product"}. Executing controller action with signature System.Threading.Tasks.Task1[Volo.Abp.Application.Dtos.PagedResultDto1[CarePlus.ProductService.Products.ProductDto]] GetListAsync(CarePlus.ProductService.Products.GetProductsInput) on controller CarePlus.ProductService.Products.ProductController (CarePlus.ProductService.HttpApi). 2023-06-07 08:01:43.142 -05:00 [DBG] PermissionStore.GetCacheItemAsync: pn:U,pk:3a14c69e-67af-d90d-a106-3a0b568954e7,n:ProductService.Products 2023-06-07 08:01:43.148 -05:00 [DBG] Found in the cache: pn:U,pk:3a14c69e-67af-d90d-a106-3a0b568954e7,n:ProductService.Products 2023-06-07 08:01:43.150 -05:00 [DBG] PermissionStore.GetCacheItemAsync: pn:R,pk:admin,n:ProductService.Products 2023-06-07 08:01:43.155 -05:00 [DBG] Found in the cache: pn:R,pk:admin,n:ProductService.Products 2023-06-07 08:01:43.156 -05:00 [DBG] PermissionStore.GetCacheItemAsync: pn:C,pk:Angular,n:ProductService.Products 2023-06-07 08:01:43.159 -05:00 [DBG] Found in the cache: pn:C,pk:Angular,n:ProductService.Products 2023-06-07 08:01:43.266 -05:00 [ERR] Failed executing DbCommand (5ms) [Parameters=[@__ef_filter__p_0='?' (DbType = Boolean), @__ef_filter__p_1='?' (DbType = Boolean)], CommandType='"Text"', CommandTimeout='30'] SELECT count(*) FROM "Products" AS p WHERE (@__ef_filter__p_0 OR NOT (p."IsDeleted")) AND (@__ef_filter__p_1 OR (p."TenantId" IS NULL)) 2023-06-07 08:01:43.274 -05:00 [ERR] An exception occurred while iterating over the results of a query for context type 'CarePlus.ProductService.EntityFrameworkCore.ProductServiceDbContext'. Npgsql.PostgresException (0x80004005): 42703: column p.TenantId does not exist

    POSITION: 84 at Npgsql.Internal.NpgsqlConnector.<ReadMessage>g__ReadMessageLong|222_0(NpgsqlConnector connector, Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage) at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken) at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken) at Npgsql.NpgsqlCommand.ExecuteDbDataReaderAsync(CommandBehavior behavior, 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.SplitQueryingEnumerable1.AsyncEnumerator.InitializeReaderAsync(AsyncEnumerator enumerator, CancellationToken cancellationToken) at Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.NpgsqlExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func4 operation, Func4 verifySucceeded, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.Internal.SplitQueryingEnumerable1.AsyncEnumerator.MoveNextAsync() Exception data: Severity: ERROR SqlState: 42703 MessageText: column p.TenantId does not exist Position: 84 File: parse_relation.c Line: 3661 Routine: errorMissingColumn Npgsql.PostgresException (0x80004005): 42703: column p.TenantId does not exist

    POSITION: 84 at Npgsql.Internal.NpgsqlConnector.<ReadMessage>g__ReadMessageLong|222_0(NpgsqlConnector connector, Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage) at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken) at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken) at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken) at Npgsql.NpgsqlCommand.ExecuteDbDataReaderAsync(CommandBehavior behavior, 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.SplitQueryingEnumerable1.AsyncEnumerator.InitializeReaderAsync(AsyncEnumerator enumerator, CancellationToken cancellationToken) at Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.NpgsqlExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func4 operation, Func4 verifySucceeded, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.Internal.SplitQueryingEnumerable1.AsyncEnumerator.MoveNextAsync() at Microsoft.EntityFrameworkCore.Query.ShapedQueryCompilingExpressionVisitor.SingleAsync[TSource](IAsyncEnumerable`1 asyncEnumerable, CancellationToken cancellationToken) Exception data: Severity: ERROR SqlState: 42703 MessageText: column p.TenantId does not exist Position: 84 File: parse_relation.c Line: 3661 Routine: errorMissingColumn 2023-06-07 08:01:43.397 -05:00 [ERR] ---------- RemoteServiceErrorInfo ---------- { "code": null, "message": "An internal error occurred during your request!", "details": null, "data": { "Severity": "ERROR", "InvariantSeverity": "ERROR", "SqlState": "42703", "MessageText": "column p.TenantId does not exist", "Position": 84, "File": "parse_relation.c", "Line": "3661", "Routine": "errorMissingColumn" }, "validationErrors": null }

    2023-06-07 08:01:43.398 -05:00 [ERR] 42703: column p.TenantId does not exist

    POSITION: 84 Npgsql.PostgresException (0x80004005): 42703: column p.TenantId does not exist

    POSITION: 84 at Npgsql.Internal.NpgsqlConnector.

    2023-06-07 08:01:43.404 -05:00 [INF] Executing ObjectResult, writing value of type 'Volo.Abp.Http.RemoteServiceErrorResponse'. 2023-06-07 08:01:43.406 -05:00 [INF] Executed action CarePlus.ProductService.Products.ProductController.GetListAsync (CarePlus.ProductService.HttpApi) in 406.4045ms 2023-06-07 08:01:43.406 -05:00 [INF] Executed endpoint 'CarePlus.ProductService.Products.ProductController.GetListAsync (CarePlus.ProductService.HttpApi)' 2023-06-07 08:01:43.585 -05:00 [DBG] Added 0 entity changes to the current audit log 2023-06-07 08:01:43.589 -05:00 [DBG] Added 0 entity changes to the current audit log 2023-06-07 08:01:43.590 -05:00 [INF] Request finished HTTP/1.1 GET https://localhost:44361/api/product-service/products?skipCount=0&maxResultCount=10 - 0 - 500 - application/json;+charset=utf-8 862.5871ms

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    column p.TenantId does not exist

    Can you try adding and applying the migration?

    Run the dotnet ef migrations add xxx and dotnet ef database update on the ProductService.EntityFrameworkCore folder.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    column p.TenantId does not exist

    Can you try adding and applying the migration?

    Run the dotnet ef migrations add xxx and dotnet ef database update on the ProductService.EntityFrameworkCore folder.

Made with ❤️ on ABP v9.1.0-preview. Updated on November 11, 2024, 11:11