statisticssweden / PxWeb

Web application for disseminating statistical tables
https://www.scb.se/pxweb
Apache License 2.0
34 stars 23 forks source link

Bug in CsvNFileSerializer in PCAxis.Common #156

Closed JohannesFinsveen closed 2 years ago

JohannesFinsveen commented 3 years ago

Describe the bug Api returns 404 and log show this: 2021-08-17 12:55:48,195 [6] INFO api-usage - url=/api/v1/en/Example/AggregallowedNo/PR0101B3.px, type=error, caller=127.0.0.1, cached=false System.InvalidOperationException: Sekvensen inneholder ingen elementer ved System.Linq.Enumerable.First[TSource](IEnumerable`1 source) ved PCAxis.Paxiom.PivotUtil.GetPivotedModelAllStub(PXModel oldModel) ved PCAxis.Paxiom.Csv2FileSerializer.DoSerialize(PXModel model, StreamWriter wr) ved PCAxis.Paxiom.CsvFileSerializer.Serialize(PXModel model, Stream stream) ved PCAxis.Api.Serializers.Csv2Serializer.Serialize(PXModel model, ResponseBucket cacheResponse) i C:\github.com\statisticssweden\PxWeb\features\api-seri-PxWeb\PCAxis.Api\Serializers\Csv2Serializer.cs:linje 31 ved PCAxis.Api.SSDHandler.SendTableData(HttpContext context, String language, String db, String[] tablePath, ResponseBucket cacheResponse) i C:\github.com\statisticssweden\PxWeb\features\api-seri-PxWeb\PCAxis.Api\SSDHandler.cs:linje 280 ved PCAxis.Api.SSDHandler.ProcessRequest(HttpContext context) i C:\github.com\statisticssweden\PxWeb\features\api-seri-PxWeb\PCAxis.Api\SSDHandler.cs:linje 564

To Reproduce Steps to reproduce the behavior: On api with csv2 (currently just one feature branch has it) post : { "query": [ { "code": "Product group", "selection": { "filter": "item", "values": [ "01.1.1", "01.1.2" ] } }, { "code": "period", "selection": { "filter": "item", "values": [ "1", "2" ] } } ], "response": { "format": "csv" } }

to http://localhost:56338/api/v1/en/Example/AggregallowedNo/PR0101B3.px

Returns 200 changing format to csv2 yields error meggage in log :-(

It works for a diffenent table/database: http://localhost:56338/api/v1/en/Example/Misc/OfficialStatistics/officialstatistics.px with: { "query": [ { "code": "type", "selection": { "filter": "item", "values": [ "BE0101F1" ] } } ], "response": { "format": "csv3" } }

likp commented 2 years ago

@JohannesFinsveen is this fixed?

JohannesFinsveen commented 2 years ago

Yes it is.