Home > Software design >  Anypoint Studio Mulesoft deploy
Anypoint Studio Mulesoft deploy

Time:10-07

When I try to deploy the mule application in Anypoint I get the following exception:

ERROR 2022-10-06 16:52:21,942 [WrapperListener_start_runner] org.mule.runtime.module.deployment.internal.DefaultArchiveDeployer: Failed to deploy artifact [mambo-supply-4]
org.mule.runtime.deployment.model.api.DeploymentException: Failed to deploy artifact [mambo-supply-4]
Caused by: org.mule.runtime.api.exception.MuleRuntimeException: org.mule.runtime.deployment.model.api.DeploymentInitException: MuleRuntimeException: Could not find ErrorType for the given identifier: 'APIKIT:NOT_VALID_ACCESS_OAUTH'

I did a research of this and found the different types of errors for APIKIT but not this one, what does it mean and any idea of how to fix it?

I assume the exception is thrown in the endpoint.xml file in the directory src/main/mule:

<on-error-propagate type="APIKIT:NOT_VALID_ACCESS_OAUTH">
                <ee:transform doc:name="Transform Message" doc:id="a571ce2a-3c56-4028-905c-a4324e45baa4">
                        <ee:message>
                                <ee:set-payload><![CDATA[%dw 2.0 output application/json --- {"code": 401, "message": "Not authorized or bad credentials" } ]]></ee:set-payload>
                        </ee:message>
                        <ee:variables>
                                <ee:set-variable variableName="httpStatus"><![CDATA[%dw 2.0 output application/java --- 401]]></ee:set-variable>
                                        <ee:set-variable variableName="Content-Type" ><![CDATA[%dw 2.0 output application/java --- "application/json"]]></ee:set-variable>
                        </ee:variables>
                </ee:transform>
         <flow-ref name="logErrorEndGlobalException" doc:name="logErrorEndGlobalException" />
</on-error-propagate>

CodePudding user response:

In Mule 4 some errors are built-in, provided by the Mule runtime, and some are provided by connectors/modules. In this error the prefix APIKIT: indicates that it comes from the APIKit module. Looking at the documentation of APIKit errors it mentions these errors:

  • APIKIT:BAD_REQUEST
  • APIKIT:NOT_FOUND
  • APIKIT:METHOD_NOT_ALLOWED
  • APIKIT:NOT_ACCEPTABLE
  • APIKIT:UNSUPPORTED_MEDIA_TYPE

Since it is not a documented error, there is no mention of this error anywhere else, and it is not recognized at deployment, I can only assume it is a programmer error. I don't know if someone believed they could add new errors but it doesn't work that way. If this was generated automatically it could be a bug.

In any case you should delete the entire <on-error-propagate> element since it references an non-existing error.

  • Related