sfmc-devtools icon indicating copy to clipboard operation
sfmc-devtools copied to clipboard

[BUG] buildTemplate fails if replacements cause JSON string to become invalid JSON

Open JoernBerkefeld opened this issue 1 year ago • 0 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Current Behavior

depending on the market config and the metadata that bt is run on, it might result in JSON that's no longer valid. This invalid JSON is returned by Util.replaceByObject on line 381 in lib/metadataTypes/MetadataType.js and then fails when JSON.parse() is executed on it image

image

problems can look like this: image

Expected Behavior

We should try-catch this error and log the invalid json to allow users to debug it.

Steps To Reproduce

  1. Go to '...'
  2. Click on '....'
  3. Run '...'
  4. See error...

Version

5.0.1

Environment

  • OS:
  • Node:
  • npm:

Participation

  • [X] I am willing to submit a pull request for this issue.

Additional comments

No response

JoernBerkefeld avatar May 16 '23 10:05 JoernBerkefeld