Sage-Bionetworks / sage-monorepo

Where OpenChallenges, Schematic, and other Sage open source apps are built
https://sage-bionetworks.github.io/sage-monorepo/
Apache License 2.0
21 stars 12 forks source link

[Bug] The OC challenge service returns 500 error if the optional `direction` property is not specified #2243

Closed tschaffter closed 9 months ago

tschaffter commented 9 months ago

Is there an existing issue for this?

What product(s) are you seeing the problem on?

OpenChallenges

Current behavior

This query works:

http://localhost:8085/v1/challenges?direction=asc

The query fails if the property direction is not specified:

image

Expected behavior

The query http://localhost:8085/v1/challenges should return a page of challenges.

UPDATE: The goal of this ticket is to prevent future invalid incentive values to be added to the DB.

Anything else?

No response

Commit ID

b98f284beafeba27548fa417e612c5d8397c0216

Are you developing inside the dev container?

Code of Conduct

tschaffter commented 9 months ago

The error originates from this instruction used in ChallengeService.java:

    List<ChallengeDto> challenges =
        challengeMapper.convertToDtoList(challengeEntitiesPage.getContent());

It may be that the data retrieved are invalid or the mapper is not up-to-date.

tschaffter commented 9 months ago

The challenge service also show these warning when it starts:

2023-10-19 17:30:21 WARN  [restartedMain] o.f.c.i.s.DefaultSqlScriptExecutor - DB: Row 1 doesn't contain data for all columns (SQL State: 01000 - Error Code: 1261)
2023-10-19 17:30:21 WARN  [restartedMain] o.f.c.i.s.DefaultSqlScriptExecutor - DB: Row 2 doesn't contain data for all columns (SQL State: 01000 - Error Code: 1261)
2023-10-19 17:30:21 WARN  [restartedMain] o.f.c.i.s.DefaultSqlScriptExecutor - DB: Row 3 doesn't contain data for all columns (SQL State: 01000 - Error Code: 1261)
2023-10-19 17:30:21 WARN  [restartedMain] o.f.c.i.s.DefaultSqlScriptExecutor - DB: Row 4 doesn't contain data for all columns (SQL State: 01000 - Error Code: 1261)
2023-10-19 17:30:21 WARN  [restartedMain] o.f.c.i.s.DefaultSqlScriptExecutor - DB: Row 5 doesn't contain data for all columns (SQL State: 01000 - Error Code: 1261)
2023-10-19 17:30:21 WARN  [restartedMain] o.f.c.i.s.DefaultSqlScriptExecutor - DB: Row 6 doesn't contain data for all columns (SQL State: 01000 - Error Code: 1261)
2023-10-19 17:30:21 WARN  [restartedMain] o.f.c.i.s.DefaultSqlScriptExecutor - DB: Row 7 doesn't contain data for all columns (SQL State: 01000 - Error Code: 1261)
2023-10-19 17:30:21 WARN  [restartedMain] o.f.c.i.s.DefaultSqlScriptExecutor - DB: Row 8 doesn't contain data for all columns (SQL State: 01000 - Error Code: 1261)
2023-10-19 17:30:21 WARN  [restartedMain] o.f.c.i.s.DefaultSqlScriptExecutor - DB: Row 9 doesn't contain data for all columns (SQL State: 01000 - Error Code: 1261)
2023-10-19 17:30:21 WARN  [restartedMain] o.f.c.i.s.DefaultSqlScriptExecutor - DB: Row 10 doesn't contain data for all columns (SQL State: 01000 - Error Code: 1261)
2023-10-19 17:30:21 WARN  [restartedMain] o.f.c.i.s.DefaultSqlScriptExecutor - DB: Row 11 doesn't contain data for all columns (SQL State: 01000 - Error Code: 1261)
2023-10-19 17:30:21 WARN  [restartedMain] o.f.c.i.s.DefaultSqlScriptExecutor - DB: Row 12 doesn't contain data for all columns (SQL State: 01000 - Error Code: 1261)
2023-10-19 17:30:21 WARN  [restartedMain] o.f.c.i.s.DefaultSqlScriptExecutor - DB: Row 13 doesn't contain data for all columns (SQL State: 01000 - Error Code: 1261)
2023-10-19 17:30:21 WARN  [restartedMain] o.f.c.i.s.DefaultSqlScriptExecutor - DB: Row 14 doesn't contain data for all columns (SQL State: 01000 - Error Code: 1261)
2023-10-19 17:30:21 WARN  [restartedMain] o.f.c.i.s.DefaultSqlScriptExecutor - DB: Row 15 doesn't contain data for all columns (SQL State: 01000 - Error Code: 1261)
2023-10-19 17:30:21 WARN  [restartedMain] o.f.c.i.s.DefaultSqlScriptExecutor - DB: Row 16 doesn't contain data for all columns (SQL State: 01000 - Error Code: 1261)
2023-10-19 17:30:21 WARN  [restartedMain] o.f.c.i.s.DefaultSqlScriptExecutor - DB: Row 17 doesn't contain data for all columns (SQL State: 01000 - Error Code: 1261)
2023-10-19 17:30:21 WARN  [restartedMain] o.f.c.i.s.DefaultSqlScriptExecutor - DB: Row 18 doesn't contain data for all columns (SQL State: 01000 - Error Code: 1261)
2023-10-19 17:30:21 WARN  [restartedMain] o.f.c.i.s.DefaultSqlScriptExecutor - DB: Row 19 doesn't contain data for all columns (SQL State: 01000 - Error Code: 1261)
2023-10-19 17:30:21 WARN  [restartedMain] o.f.c.i.s.DefaultSqlScriptExecutor - DB: Row 20 doesn't contain data for all columns (SQL State: 01000 - Error Code: 1261)
2023-10-19 17:30:21 WARN  [restartedMain] o.f.c.i.s.DefaultSqlScriptExecutor - DB: Row 21 doesn't contain data for all columns (SQL State: 01000 - Error Code: 1261)
2023-10-19 17:30:21 WARN  [restartedMain] o.f.c.i.s.DefaultSqlScriptExecutor - DB: Row 22 doesn't contain data for all columns (SQL State: 01000 - Error Code: 1261)
2023-10-19 17:30:21 WARN  [restartedMain] o.f.c.i.s.DefaultSqlScriptExecutor - DB: Row 23 doesn't contain data for all columns (SQL State: 01000 - Error Code: 1261)
2023-10-19 17:30:21 WARN  [restartedMain] o.f.c.i.s.DefaultSqlScriptExecutor - DB: Row 24 doesn't contain data for all columns (SQL State: 01000 - Error Code: 1261)
2023-10-19 17:30:21 WARN  [restartedMain] o.f.c.i.s.DefaultSqlScriptExecutor - DB: Row 25 doesn't contain data for all columns (SQL State: 01000 - Error Code: 1261)
2023-10-19 17:30:21 WARN  [restartedMain] o.f.c.i.s.DefaultSqlScriptExecutor - DB: Row 26 doesn't contain data for all columns (SQL State: 01000 - Error Code: 1261)
2023-10-19 17:30:21 WARN  [restartedMain] o.f.c.i.s.DefaultSqlScriptExecutor - DB: Row 27 doesn't contain data for all columns (SQL State: 01000 - Error Code: 1261)
2023-10-19 17:30:21 WARN  [restartedMain] o.f.c.i.s.DefaultSqlScriptExecutor - DB: Row 28 doesn't contain data for all columns (SQL State: 01000 - Error Code: 1261)
2023-10-19 17:30:21 WARN  [restartedMain] o.f.c.i.s.DefaultSqlScriptExecutor - DB: Row 29 doesn't contain data for all columns (SQL State: 01000 - Error Code: 1261)
2023-10-19 17:30:21 WARN  [restartedMain] o.f.c.i.s.DefaultSqlScriptExecutor - DB: Row 30 doesn't contain data for all columns (SQL State: 01000 - Error Code: 1261)
2023-10-19 17:30:21 WARN  [restartedMain] o.f.c.i.s.DefaultSqlScriptExecutor - DB: Row 31 doesn't contain data for all columns (SQL State: 01000 - Error Code: 1261)
2023-10-19 17:30:21 WARN  [restartedMain] o.f.c.i.s.DefaultSqlScriptExecutor - DB: Row 32 doesn't contain data for all columns (SQL State: 01000 - Error Code: 1261)
2023-10-19 17:30:21 WARN  [restartedMain] o.f.c.i.s.DefaultSqlScriptExecutor - DB: Row 33 doesn't contain data for all columns (SQL State: 01000 - Error Code: 1261)
2023-10-19 17:30:21 WARN  [restartedMain] o.f.c.i.s.DefaultSqlScriptExecutor - DB: Row 34 doesn't contain data for all columns (SQL State: 01000 - Error Code: 1261)
2023-10-19 17:30:21 WARN  [restartedMain] o.f.c.i.s.DefaultSqlScriptExecutor - DB: Row 35 doesn't contain data for all columns (SQL State: 01000 - Error Code: 1261)
2023-10-19 17:30:21 WARN  [restartedMain] o.f.c.i.s.DefaultSqlScriptExecutor - DB: Row 36 doesn't contain data for all columns (SQL State: 01000 - Error Code: 1261)
2023-10-19 17:30:21 WARN  [restartedMain] o.f.c.i.s.DefaultSqlScriptExecutor - DB: Row 37 doesn't contain data for all columns (SQL State: 01000 - Error Code: 1261)
2023-10-19 17:30:21 WARN  [restartedMain] o.f.c.i.s.DefaultSqlScriptExecutor - DB: Row 38 doesn't contain data for all columns (SQL State: 01000 - Error Code: 1261)
2023-10-19 17:30:21 WARN  [restartedMain] o.f.c.i.s.DefaultSqlScriptExecutor - DB: Row 39 doesn't contain data for all columns (SQL State: 01000 - Error Code: 1261)
2023-10-19 17:30:21 WARN  [restartedMain] o.f.c.i.s.DefaultSqlScriptExecutor - DB: Row 40 doesn't contain data for all columns (SQL State: 01000 - Error Code: 1261)
2023-10-19 17:30:21 WARN  [restartedMain] o.f.c.i.s.DefaultSqlScriptExecutor - DB: Row 41 doesn't contain data for all columns (SQL State: 01000 - Error Code: 1261)
2023-10-19 17:30:21 WARN  [restartedMain] o.f.c.i.s.DefaultSqlScriptExecutor - DB: Row 42 doesn't contain data for all columns (SQL State: 01000 - Error Code: 1261)
2023-10-19 17:30:21 WARN  [restartedMain] o.f.c.i.s.DefaultSqlScriptExecutor - DB: Row 43 doesn't contain data for all columns (SQL State: 01000 - Error Code: 1261)
2023-10-19 17:30:21 WARN  [restartedMain] o.f.c.i.s.DefaultSqlScriptExecutor - DB: Row 44 doesn't contain data for all columns (SQL State: 01000 - Error Code: 1261)
2023-10-19 17:30:21 WARN  [restartedMain] o.f.c.i.s.DefaultSqlScriptExecutor - DB: Row 45 doesn't contain data for all columns (SQL State: 01000 - Error Code: 1261)
2023-10-19 17:30:21 WARN  [restartedMain] o.f.c.i.s.DefaultSqlScriptExecutor - DB: Row 46 doesn't contain data for all columns (SQL State: 01000 - Error Code: 1261)
2023-10-19 17:30:21 WARN  [restartedMain] o.f.c.i.s.DefaultSqlScriptExecutor - DB: Row 47 doesn't contain data for all columns (SQL State: 01000 - Error Code: 1261)
2023-10-19 17:30:21 WARN  [restartedMain] o.f.c.i.s.DefaultSqlScriptExecutor - DB: Row 48 doesn't contain data for all columns (SQL State: 01000 - Error Code: 1261)
2023-10-19 17:30:21 WARN  [restartedMain] o.f.c.i.s.DefaultSqlScriptExecutor - DB: Row 49 doesn't contain data for all columns (SQL State: 01000 - Error Code: 1261)
2023-10-19 17:30:21 WARN  [restartedMain] o.f.c.i.s.DefaultSqlScriptExecutor - DB: Row 50 doesn't contain data for all columns (SQL State: 01000 - Error Code: 1261)
2023-10-19 17:30:21 WARN  [restartedMain] o.f.c.i.s.DefaultSqlScriptExecutor - DB: Row 51 doesn't contain data for all columns (SQL State: 01000 - Error Code: 1261)
2023-10-19 17:30:21 WARN  [restartedMain] o.f.c.i.s.DefaultSqlScriptExecutor - DB: Row 52 doesn't contain data for all columns (SQL State: 01000 - Error Code: 1261)
2023-10-19 17:30:21 WARN  [restartedMain] o.f.c.i.s.DefaultSqlScriptExecutor - DB: Row 53 doesn't contain data for all columns (SQL State: 01000 - Error Code: 1261)
2023-10-19 17:30:21 WARN  [restartedMain] o.f.c.i.s.DefaultSqlScriptExecutor - DB: Row 54 doesn't contain data for all columns (SQL State: 01000 - Error Code: 1261)
2023-10-19 17:30:21 WARN  [restartedMain] o.f.c.i.s.DefaultSqlScriptExecutor - DB: Row 55 doesn't contain data for all columns (SQL State: 01000 - Error Code: 1261)
2023-10-19 17:30:21 WARN  [restartedMain] o.f.c.i.s.DefaultSqlScriptExecutor - DB: Row 56 doesn't contain data for all columns (SQL State: 01000 - Error Code: 1261)
2023-10-19 17:30:21 WARN  [restartedMain] o.f.c.i.s.DefaultSqlScriptExecutor - DB: Row 57 doesn't contain data for all columns (SQL State: 01000 - Error Code: 1261)
2023-10-19 17:30:21 WARN  [restartedMain] o.f.c.i.s.DefaultSqlScriptExecutor - DB: Row 58 doesn't contain data for all columns (SQL State: 01000 - Error Code: 1261)
2023-10-19 17:30:21 WARN  [restartedMain] o.f.c.i.s.DefaultSqlScriptExecutor - DB: Row 59 doesn't contain data for all columns (SQL State: 01000 - Error Code: 1261)
2023-10-19 17:30:21 WARN  [restartedMain] o.f.c.i.s.DefaultSqlScriptExecutor - DB: Row 60 doesn't contain data for all columns (SQL State: 01000 - Error Code: 1261)
2023-10-19 17:30:21 WARN  [restartedMain] o.f.c.i.s.DefaultSqlScriptExecutor - DB: Row 61 doesn't contain data for all columns (SQL State: 01000 - Error Code: 1261)
2023-10-19 17:30:21 WARN  [restartedMain] o.f.c.i.s.DefaultSqlScriptExecutor - DB: Row 62 doesn't contain data for all columns (SQL State: 01000 - Error Code: 1261)
2023-10-19 17:30:21 WARN  [restartedMain] o.f.c.i.s.DefaultSqlScriptExecutor - DB: Row 63 doesn't contain data for all columns (SQL State: 01000 - Error Code: 1261)
2023-10-19 17:30:21 WARN  [restartedMain] o.f.c.i.s.DefaultSqlScriptExecutor - DB: Row 64 doesn't contain data for all columns (SQL State: 01000 - Error Code: 1261)
tschaffter commented 9 months ago

The issue may be related to this warning that occurs when mapping the entities to DTOs:

2023-10-19 17:46:55 WARN  [http-nio-8085-exec-1] o.s.w.s.m.m.a.ExceptionHandlerExceptionResolver - Resolved [java.lang.IllegalArgumentException: Unexpected value '']
tschaffter commented 9 months ago

The issue is related to the incentives as the following block triggers the issue:

      dto.incentives(
          entity.getIncentives().stream()
              .map(o -> ChallengeIncentiveDto.fromValue(o.getName()))
              .toList());

The issue is because one of the incentive value is set to others instead of other. This typo will be fixed in #2246.

tschaffter commented 9 months ago

Fixed via an update of the data (CSV files)