Skip to content

Commit 13706b6

Browse files
author
Benito Visone
authored
fix: explicitly handle ProcessingException and add SQS VPC Endpoint (#883)
* feat: add explicit ProcessingException handling * feat: enable sqs vpc endpoint * feat: set pdv-api rest client timeout to 1000ms * fix: use more appropriate error code
1 parent 8949a3f commit 13706b6

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

src/infra/modules/network/main.tf

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,15 +150,13 @@ module "vpc_endpoints" {
150150
# security_group_ids = [aws_security_group.vpc_tls.id]
151151
# tags = { Name = "apigw-endpoint" }
152152
# },
153-
/*
154153
sqs = {
155154
service = "sqs"
156155
private_dns_enabled = true
157156
subnet_ids = module.vpc.private_subnets
158157
security_group_ids = [aws_security_group.vpc_tls.id]
159158
tags = { Name = "sqs" }
160159
},
161-
*/
162160
/*
163161
events = {
164162
service = "events"

src/oneid/oneid-ecs-core/src/main/java/it/pagopa/oneid/service/OIDCServiceImpl.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
import it.pagopa.oneid.web.dto.TokenDataDTO;
4646
import jakarta.enterprise.context.ApplicationScoped;
4747
import jakarta.inject.Inject;
48+
import jakarta.ws.rs.ProcessingException;
4849
import jakarta.ws.rs.WebApplicationException;
4950
import java.io.StringWriter;
5051
import java.net.URI;
@@ -279,13 +280,15 @@ public TokenDataDTO getOIDCTokens(String requestId, String clientId,
279280
() -> Log.warn("API Key not found for clientId: " + clientId
280281
+ ", can't retrieve pairwise sub from PDV")
281282
);
282-
} catch (WebApplicationException e) {
283+
} catch (WebApplicationException | ProcessingException e) {
283284
// if PDV returns an error, we log it but we don't block the authentication flow
284285
Log.error("error during PDV upsertUser call: " + e.getMessage());
285286
// Send message to SQS to manage retry mechanism asynchronously
286287
sendPDVErrorSQSMessage(clientId, savePDVUserDTO);
287288
// Update metric on CloudWatch
288-
cloudWatchConnectorImpl.sendPDVErrorMetricData(e.getResponse().getStatus());
289+
cloudWatchConnectorImpl.sendPDVErrorMetricData(
290+
e instanceof WebApplicationException ? ((WebApplicationException) e).getResponse()
291+
.getStatus() : 504);
289292
}
290293
} else {
291294
// if fiscalNumber is not present, we can't generate the pairwise sub

src/oneid/oneid-ecs-core/src/main/resources/application.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,6 @@ quarkus.rest-client.pdv-api.url=${PDV_BASE_URL:https://api.dev.pdv.pagopa.it}
7777
# Queue url for PDV error async processing
7878
pdv_error_queue_url=${PDV_ERROR_QUEUE_URL:https://localhost:8000/errors-queue}
7979
# Timeout settings for the PDV API client
80-
quarkus.rest-client.pdv-api.connect-timeout=5000
81-
quarkus.rest-client.pdv-api.read-timeout=5000
80+
quarkus.rest-client.pdv-api.connect-timeout=1000
81+
quarkus.rest-client.pdv-api.read-timeout=1000
8282
#endregion

0 commit comments

Comments
 (0)