Document XMP metadata

Your solution work for me until set the metadata with the batchplay code. It didn’t edit the metadata and didn’t return any error. Do you have any ideas to why? I change the code a bit

const bp = require("photoshop").action.batchPlay;
const getDocumentXMP = () => {
  return bp([{
    _obj: "get",
    _target: {
      _ref: [
        { _property: "XMPMetadataAsUTF8" },
        { _ref: "document", _enum: "ordinal", _value: "targetEnum" }
      ]
    }
  }], { synchronousExecution: true })[0].XMPMetadataAsUTF8
}
const setDocumentXMP = (xmpString) => {
  bp([{
    _obj: "set",
    _target: [
      { _ref: "property", _property: "XMPMetadataAsUTF8" },
      { _ref: "document", _enum: "ordinal", _value: "targetEnum" }
    ],
    to: {
      _obj: "document",
      XMPMetadataAsUTF8: xmpString
    }
  }], {});
}
const getDocumentMetadata = (key, prefix) => {
  const xmpString = getDocumentXMP();
  const obj = convert(xmpString, { format: "object" });
  return obj["x:xmpmeta"]['rdf:RDF']['rdf:Description'][`${prefix}:${key}`] || "";
}
const setDocumentMetadata = (key, value, prefix) => {
  const xmpString = getDocumentXMP();
  const obj = convert(xmpString, { format: "object" });
  obj["x:xmpmeta"]['rdf:RDF']['rdf:Description'][`${prefix}:${key}`] = value;
  const newXmpString = convert(obj, { format: "xml" })
  setDocumentXMP(newXmpString);
}
try {
  setDocumentMetadata("CreateDate", "1", "xmp");
} catch (error) {
  console.log(error.message);
}