Skip to main content
Question

Error “Cannot read properties of undefined (reading ‘length’)” when trying to create a draft campaign in Mailerlite

  • 7 June 2024
  • 4 replies
  • 29 views

I’m trying to create a draft campaign in Mailerlite. I get the error code “Cannot read properties of undefined (reading ‘length’)”. Here’s a screenshot.

 

 

I noticed that in the Data in, it shows the ‘email content’ as “no data to show for this record”.

 

 

However, there absolutely IS data in the field ‘email content’. It’s the html of the template campaign I set up.

 

 

After some fiddling, I suspect that it has to do with the length of the html. I could get it to work with shorter strings.

 

 

It also works with just a portion of the html, though I didn’t dive into counting the exact character number where it starts to break.

 

So now I’m stuck. I can’t shorten the html for the campaign (or if I can, I don’t know how to: zero coding knowledge).

 

Any insight?

4 replies

Userlevel 7
Badge +14

Hi @Sigurdur130 

Try just including the HTML from between these tags:

<body></body>

 

 

Userlevel 1
Badge +1

Hey @Troy Tessalone, I gave it a try, same error messages. No data to show for this record.

 

However, I only found an exact match for the </body> tag, not the <body> one. Closest I could find was 

<body class="font-sans antialiased bg-white dark:bg-gray-800 overflow-hidden">. I started from there, though.
 

 

Userlevel 7
Badge +14

@Sigurdur130 

Looks like the HTML has a bunch of extra HTML that can probably be removed. e.g. <scripts>

I’d recommend simplifying the HTML as much as possible.

 

Otherwise, you may want to try reaching out to MailerLite Support for help with their Zap app and underlying API endpoint.

https://developers.mailerlite.com/docs/campaigns.html#create-a-campaign

 

 

Userlevel 1
Badge +1

Your post showed me another problem that kind of obviates anything else. In the developer docs they note that the account must be on the advanced plan. I’m on the growing business plan. This isn’t specified in the Zap, so I had no clue.

I guess I can safely throw in the towel on this. Thanks for trying to help, @Troy Tessalone =)

Reply