diff --git a/src/lib/waku_message/index.ts b/src/lib/waku_message/index.ts index 602d3b9d20..2c2d45ade9 100644 --- a/src/lib/waku_message/index.ts +++ b/src/lib/waku_message/index.ts @@ -252,12 +252,12 @@ export class WakuMessage { } get payloadAsUtf8(): string { - if (!this.proto.payload) { + if (!this.payload) { return ""; } try { - return bytesToUtf8(this.proto.payload); + return bytesToUtf8(this.payload); } catch (e) { dbg("Could not decode byte as UTF-8", e); return ""; @@ -265,7 +265,10 @@ export class WakuMessage { } get payload(): Uint8Array | undefined { - return this.proto.payload; + if (this.proto.payload) { + return new Uint8Array(this.proto.payload); + } + return; } get contentTopic(): string | undefined {