mulesoft / mule-migration-assistant

Migration Framework
BSD 3-Clause "New" or "Revised" License
26 stars 35 forks source link

DW migration does not account for Mule 3 bindings migration #492

Closed holiday-sunrise closed 1 month ago

holiday-sunrise commented 3 years ago

The Example DataWeave Script 1.0

%dw 1.0
%output application/json
---
{
    code: outboundProperties."http.status" as :string,
    message: inboundProperties."http.reason"
}

is migrated to

%dw 2.0
output application/json  
---
{
  code: outboundProperties."http.status" as String,
  message: inboundProperties."http.reason"
}

fails at Runtime with.

<ee:message>
<ee:set-payload resource="dw/error-response.dwl"></ee:set-payload>
</ee:message>
</ee:transform>
Error type            : MULE:EXPRESSION
FlowStack             : at get:\base-articles\(articleID):api-config(get:\base-articles\(articleID):api-config/processors/4/route/0/processors/1 @ companion-articles-api-mule4:companion-articles-api.xml:195 (Transform Message))
at api-main(api-main/processors/2 @ companion-articles-api-mule4:companion-articles-api.xml:54 (APIkit Router))

  (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************

********************************************************************************
Message               : "Script '%dw 2.0
output application/json  
---
{
  code: outboundProperties."http.status" as String,
  message: inboundProperties."http.reason"
} ' has errors: 
    Unable to resolve reference of outboundProperties. at 5 : 5
    Unable to resolve reference of inboundProperties. at 6 : 6" evaluating expression: "%dw 2.0
output application/json  
---
{
  code: outboundProperties."http.status" as String,
  message: inboundProperties."http.reason"
}".
Element               : (None)
Element DSL           : (None)
Error type            : MULE:EXPRESSION
FlowStack             : (None)

  (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************
afelisatti commented 3 years ago

Hi, @holiday-sunrise. Thanks for reporting this and the clear example shared. It looks like the DataWeave migrant is not considering that outboundProperties and inboundProperties are no longer valid bindings in Mule 4 and should be referenced as vars.compatibility_outboundProperties and vars.compatibility_inboundProperties. We will review this and evaluate a fix.

holiday-sunrise commented 8 months ago

Any News