Altinn / Altinn/app-lib-dotnet

Prefill logs error when trying to prefill data not appliccable to user

Open
#302 0 comments 0 reactions 0 assignees View on GitHub
kind/bug org/srf status/triage
Dominant language
C#
Stars
8
Forks
27
Avg merge
1h 21m
Merged PRs (30d)
7

Description

### Description of the bug

Applications may be used for both organisations and people and need to supply prefill for both types of users.
Currently if a person tries to start an instance of an app where some fields are prefilled from ER prefill will log the absence of an organisation as an Error. The same happens if a oraganisation starts an instance of an app with prefill from DSF.

For an app used for both organisations and people with prefill from ER and DSF, to cover both users, all traces will contain a error log from Prefill with either the error `Could not prefill from DSF, person is not defined` or `Could not prefill from ER, organisation is not defined`.

The only way currently to avoid these is to turn off all error logs from prefill. This could potentially hide other errors during prefill and leave the logs lacking vital information when investigating an error.

We should consider if the error messages mentioned above should be changed to warnings making it possible to filter them out and still keep the error logs.

### Steps To Reproduce

1. Create an app that prefill both DSF and ER information
2. Start a new instance as a person, and as an organisation
3. Inspect the logs and see error log statements for both cases even though they bot are OK

### Additional Information

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue with an app that prefills both DSF and ER data, once as a person and once as an organisation, then trace the prefill logging for the two reported messages. Determine whether an inapplicable user type should be logged as a warning while genuine prefill failures remain errors, and verify the resulting log levels in both cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend, observability
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.