Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

draft-api: Stop ignoring error in ArticleApiClient #292

Merged
merged 2 commits into from
Sep 4, 2023

Conversation

jnatten
Copy link
Contributor

@jnatten jnatten commented Sep 1, 2023

Fixes NDLANO/Issues#3696

Var visst et par problemer her.

  • ExternalIds ble sendt med som query-parameter selv om listen var tom.
    • Det ble tolket av endepunktet som List("") så vi endte opp med å bruke soft-valideringen selvom vi ikke skulle det
  • Vi ignorerte feilen fra article-api requesten med et uhell.

Kan testes ved å sjekke at publisering fungerer når det skal og feiler når det skal.
Testcasen fra issuet var at den skulle feile når metadescription var tom.

Also only send `external-ids` parameter if externalIds is nonEmpty, this
will avoid accidentally using soft-validation which we appear to have
been using for a while :^)
@gunnarvelle
Copy link
Member

Fikk feil ved publisering av artikkel:

[article-api] 2023-09-01 13:01:41.589 [pool-3-thread-1] () ERROR no.ndla.articleapi.integration.SearchApiClient$SearchApiClient.$anonfun$indexArticle$1#63: Failed to indexed article with id: '38203' and revision '12' in search-api
no.ndla.network.model.HttpRequestException: Could not parse response with body: {"id":38203,"revision":12,"title":[{"title":"Artikkel med kommentar12","language":"nb"}],"content":[{"content":"<section></section>","language":"nb"}],"copyright":{"license":"CC-BY-SA-4.0","origin":"","creators":[{"type":"originator","name":"adsf"}],"processors":[],"rightsholders":[]},"tags":[{"tags":["a","d","dd"],"language":"nb"}],"requiredLibraries":[],"visualElement":[],"introduction":[],"metaDescription":[{"content":"meta","language":"nb"}],"metaImage":[],"created":"2023-06-20T09:06:42.000Z","updated":"2023-09-01T13:01:41.285Z","updatedBy":"mFfrGSyCOBDWB2FiWlB_fdw7","published":"2023-06-20T09:06:42.000Z","articleType":"standard","grepCodes":[],"conceptIds":[],"availability":"everyone","relatedContent":[],"revisionDate":"2028-06-20T09:06:42.000Z"}
	at no.ndla.network.NdlaClient$NdlaClient.parseResponse(NdlaClient.scala:85) ~[article-api.jar:0.0.1]
	at no.ndla.network.NdlaClient$NdlaClient.$anonfun$doFetch$1(NdlaClient.scala:55) ~[article-api.jar:0.0.1]
	at scala.util.Success.flatMap(Try.scala:258) ~[article-api.jar:0.0.1]
	at no.ndla.network.NdlaClient$NdlaClient.doFetch(NdlaClient.scala:54) ~[article-api.jar:0.0.1]
	at no.ndla.network.NdlaClient$NdlaClient.fetch(NdlaClient.scala:30) ~[article-api.jar:0.0.1]
	at no.ndla.articleapi.integration.SearchApiClient$SearchApiClient.$anonfun$postWithData$1(SearchApiClient.scala:76) ~[article-api.jar:0.0.1]
	at scala.concurrent.Future$.$anonfun$apply$1(Future.scala:678) ~[article-api.jar:0.0.1]
	at scala.concurrent.impl.Promise$Transformation.run(Promise.scala:467) ~[article-api.jar:0.0.1]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
	at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: org.json4s.MappingException: No usable value for created
No usable value for underlying
No constructor for type ZonedDateTime, JNothing

@gunnarvelle
Copy link
Member

search-api indekserer men det er responsen til article-api som ikkje tolkes rett.

@jnatten
Copy link
Contributor Author

jnatten commented Sep 1, 2023

search-api indekserer men det er responsen til article-api som ikkje tolkes rett.

Aha er en bug med NdlaClient.fetch med at den ikke tar i mot json4s formats. Fikser 👍

@jnatten jnatten merged commit e28098f into master Sep 4, 2023
11 checks passed
@jnatten jnatten deleted the 3696-metadescriptionless-failure branch September 4, 2023 07:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants