This project is based on Mulesoft Dataweave and Salesforce to provide secure, reliable, API access for all the Scores apps and projects. It is hosted on Anypoint and acts as the transactional hub, in concert with the authentication API
3
stars
1
forks
source link
Student Registration Endpoint needs to allow contact creation even if it sees a duplicate and respond with explanation when required fields are missing or salesforce rejects a duplicate contact #124
A. "Matching Record Found"
B. "Contact Created"
C. "Field Error: {fieldname}"
Present Situation
The Student Registration app fails to create a new record as a result of a 500 error.
The Data API log examples posted below.
Duplicate Contact
8:25:10.701 02/23/2022 Worker-0 [MuleRuntime].uber.11120: [salesforce-data-api-prod].post:\contacts:application\json:salesforce-data-api-config.BLOCKING @353e5d67 INFO
event:fd1cf590-9518-11ec-b2a3-06236ed42cd0 Contact with same name and DOB has been found
18:25:10.706 02/23/2022 Worker-0 [MuleRuntime].uber.11119: [salesforce-data-api-prod].post:\contacts:application\json:salesforce-data-api-config.CPU_INTENSIVE @5f459161 ERROR
event:fd1cf590-9518-11ec-b2a3-06236ed42cd0
This may be a result of an invalid (null) value sent to the Student Registration method of the /Contact endpoint, missing Contact_type and School_Site_ID. If that is the case, the API needs to return a graceful error message:
"Missing values for [field list]"
Message : required key [SchoolSiteId] not found
required key [ContactType] not found
Element : salesforce-data-api-main/processors/0 @ salesforce-data-api-prod:salesforce-data-api.xml:48
Element DSL : </apikit:router>
Error type : APIKIT:BAD_REQUEST
FlowStack : at salesforce-data-api-main(salesforce-data-api-main/processors/0 @ salesforce-data-api-prod:salesforce-data-api.xml:48)
Payload Type : org.mule.runtime.core.internal.streaming.bytes.ManagedCursorStreamProvider
Root Exception stack trace:
org.mule.module.apikit.api.exception.BadRequestException: required key [SchoolSiteId] not found
required key [ContactType] not found
at org.mule.module.apikit.validation.body.schema.v2.RestSchemaV2Validator.validate(RestSchemaV2Validator.java:32)
at org.mule.module.apikit.validation.BodyValidator.validateAsString(BodyValidator.java:128)
at org.mule.module.apikit.validation.BodyValidator.validate(BodyValidator.java:85)
at org.mule.module.apikit.validation.RestRequestValidator.validate(RestRequestValidator.java:60)
at org.mule.module.apikit.api.validation.RequestValidator.validate(RequestValidator.java:44)
at org.mule.module.apikit.api.validation.RequestValidator.validate(RequestValidator.java:29)
at org.mule.module.apikit.Router.doRoute(Router.java:165)
at org.mule.module.apikit.Router.processEvent(Router.java:150)
at org.mule.module.apikit.Router.processWithExtension(Router.java:138)
at org.mule.runtime.core.internal.util.rx.RxUtils.lambda$flatMap$13(RxUtils.java:334)
at reactor.core.publisher.FluxFlatMap$FlatMapMain.onNext(FluxFlatMap.java:381)
at org.mule.runtime.core.privileged.processor.chain.AbstractMessageProcessorChain$2.onNext(AbstractMessageProcessorChain.java:432)
at org.mule.runtime.core.privileged.processor.chain.AbstractMessageProcessorChain$2.onNext(AbstractMessageProcessorChain.java:427)
at reactor.core.publisher.FluxPeekFuseable$PeekFuseableSubscriber.onNext(FluxPeekFuseable.java:204)
at reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.onNext(FluxOnAssembly.java:351)
at reactor.core.publisher.FluxPeekFuseable$PeekFuseableSubscriber.onNext(FluxPeekFuseable.java:204)
at reactor.core.publisher.FluxPeekFuseable$PeekFuseableSubscriber.onNext(FluxPeekFuseable.java:204)
at reactor.core.publisher.FluxPublishOn$PublishOnSubscriber.runAsync(FluxPublishOn.java:447)
at reactor.core.publisher.FluxPublishOn$PublishOnSubscriber.run(FluxPublishOn.java:534)
at reactor.core.scheduler.WorkerTask.call(WorkerTask.java:84)
at reactor.core.scheduler.WorkerTask.call(WorkerTask.java:37)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.mule.service.scheduler.internal.AbstractRunnableFutureDecorator.doRun(AbstractRunnableFutureDecorator.java:111)
at org.mule.service.scheduler.internal.RunnableFutureDecorator.run(RunnableFutureDecorator.java:54)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Dependency
This depends on https://github.com/AmericaSCORESBayArea/salesforce-data-api/issues/114 being completed
Acceptable API Responses
A. "Matching Record Found" B. "Contact Created" C. "Field Error: {fieldname}"
Present Situation
The Student Registration app fails to create a new record as a result of a 500 error. The Data API log examples posted below. Duplicate Contact 8:25:10.701 02/23/2022 Worker-0 [MuleRuntime].uber.11120: [salesforce-data-api-prod].post:\contacts:application\json:salesforce-data-api-config.BLOCKING @353e5d67 INFO event:fd1cf590-9518-11ec-b2a3-06236ed42cd0 Contact with same name and DOB has been found 18:25:10.706 02/23/2022 Worker-0 [MuleRuntime].uber.11119: [salesforce-data-api-prod].post:\contacts:application\json:salesforce-data-api-config.CPU_INTENSIVE @5f459161 ERROR event:fd1cf590-9518-11ec-b2a3-06236ed42cd0
This may be a result of an invalid (null) value sent to the Student Registration method of the /Contact endpoint, missing Contact_type and School_Site_ID. If that is the case, the API needs to return a graceful error message: "Missing values for [field list]"
the cause of the fail has to be addressed in the requesting app as well https://github.com/AmericaSCORESBayArea/student-registration/issues/164
09:40:39.530 11/02/2021 Worker-0 [MuleRuntime].uber.1984: [salesforce-data-api-prod].salesforce-data-api-main.CPU_LITE @7a4c7b62 ERROR event:d92290f0-3bea-11ec-bfee-02bb758fdc02
Invalid value for a key field
Message : required key [SchoolSiteId] not found required key [ContactType] not found Element : salesforce-data-api-main/processors/0 @ salesforce-data-api-prod:salesforce-data-api.xml:48 Element DSL :</apikit:router>
Error type : APIKIT:BAD_REQUEST
FlowStack : at salesforce-data-api-main(salesforce-data-api-main/processors/0 @ salesforce-data-api-prod:salesforce-data-api.xml:48)
Payload Type : org.mule.runtime.core.internal.streaming.bytes.ManagedCursorStreamProvider
Root Exception stack trace: org.mule.module.apikit.api.exception.BadRequestException: required key [SchoolSiteId] not found required key [ContactType] not found at org.mule.module.apikit.validation.body.schema.v2.RestSchemaV2Validator.validate(RestSchemaV2Validator.java:32) at org.mule.module.apikit.validation.BodyValidator.validateAsString(BodyValidator.java:128) at org.mule.module.apikit.validation.BodyValidator.validate(BodyValidator.java:85) at org.mule.module.apikit.validation.RestRequestValidator.validate(RestRequestValidator.java:60) at org.mule.module.apikit.api.validation.RequestValidator.validate(RequestValidator.java:44) at org.mule.module.apikit.api.validation.RequestValidator.validate(RequestValidator.java:29) at org.mule.module.apikit.Router.doRoute(Router.java:165) at org.mule.module.apikit.Router.processEvent(Router.java:150) at org.mule.module.apikit.Router.processWithExtension(Router.java:138) at org.mule.runtime.core.internal.util.rx.RxUtils.lambda$flatMap$13(RxUtils.java:334) at reactor.core.publisher.FluxFlatMap$FlatMapMain.onNext(FluxFlatMap.java:381) at org.mule.runtime.core.privileged.processor.chain.AbstractMessageProcessorChain$2.onNext(AbstractMessageProcessorChain.java:432) at org.mule.runtime.core.privileged.processor.chain.AbstractMessageProcessorChain$2.onNext(AbstractMessageProcessorChain.java:427) at reactor.core.publisher.FluxPeekFuseable$PeekFuseableSubscriber.onNext(FluxPeekFuseable.java:204) at reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.onNext(FluxOnAssembly.java:351) at reactor.core.publisher.FluxPeekFuseable$PeekFuseableSubscriber.onNext(FluxPeekFuseable.java:204) at reactor.core.publisher.FluxPeekFuseable$PeekFuseableSubscriber.onNext(FluxPeekFuseable.java:204) at reactor.core.publisher.FluxPublishOn$PublishOnSubscriber.runAsync(FluxPublishOn.java:447) at reactor.core.publisher.FluxPublishOn$PublishOnSubscriber.run(FluxPublishOn.java:534) at reactor.core.scheduler.WorkerTask.call(WorkerTask.java:84) at reactor.core.scheduler.WorkerTask.call(WorkerTask.java:37) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at org.mule.service.scheduler.internal.AbstractRunnableFutureDecorator.doRun(AbstractRunnableFutureDecorator.java:111) at org.mule.service.scheduler.internal.RunnableFutureDecorator.run(RunnableFutureDecorator.java:54) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748)