Error: Unable to publish model. Failed to execute 'append' on 'FormData': parameter 2 is not of type 'Blob'

I’m using CloudCode with JS and seem to be getting an error when deploying:

Error: Unable to publish model. Failed to execute ‘append’ on ‘FormData’: parameter 2 is not of type ‘Blob’

This error was not appearing before, so I was wondering what could be the cause for the error?

Application ID: 330D51DD-F8A7-07E8-FF88-819D27EFCB00

Hi, @Social_Smarttwigs

How can we reproduce the issue in the app?

Regards,
Marina

@Marina.Kan I’m not too sure, since the deployment was working just fine in the past.

I assume the error lies between lines 285-311 in here.

Though, I’m not too sure since this was working just fine in the past.

@Marina.Kan Here’s an image of where the error is located:

1 Like

@Social_Smarttwigs what model name do you use for the deployment?

Regards,
Marina

@Marina.Kan It’s deployed to model “default”

@Social_Smarttwigs, Let’s try the following. Please check the package.json file. What version of backendless-coderunner do you have there? Try to update to the latest version, which is 6.5.2. Will be waiting for you reply

Regards,
Marina

@Marina.Kan Still getting the same error

@Social_Smarttwigs Could we identify when the error started to appear? Did you make any changes to your code? And what character of these changes are?

I was first aware of the issue yesterday. I tried deploying the same code that was last published but the same error appears.

Hello @Social_Smarttwigs

Can you provide us with what the formData variable look like? Check before doing this, does it store personal data

Regards,
Viktor

The formData variable is part of the “backendless-coderunner” package.

Here’s an image of the output:

I’m not sure what could be causing this error as I can’t even deploy previous builds that were deployable. All I can assume is that the error lies within the “backendless-request” package that I stated before:

@Social_Smarttwigs how did solve this problem? I am running into the same error…

Hello @Eric_ten_Voorde

Please provide steps to reproduce the problem.

Regards,
Inna

I just try to deploy a service with “npm run deploy”. Then I run into this error.

When I use “npm run debug” it works fine.

Hi @Eric_ten_Voorde ,

Sorry for delay with response.
Could you please provide value of “formData” variable as my colleague asked TC before? We need this value for better understanding of problem. Please check and blur before posting personal data if it present.

Regards, Andriy

formData is defined in the module backendless-coderunner as:

const formData = {
  model: this.app.model || 'default',
  code : {
    value  : modelZip,
    options: {
      filename   : 'code',
      contentType: 'application/zip'
    }
  }
}

The error seems to be trigger by modelZip being of type Buffer. As it is passed on it ultimately should be Blob as per:
https://microsoft.github.io/PowerBI-JavaScript/interfaces/_node_modules_typedoc_node_modules_typescript_lib_lib_dom_d_.formdata.html#append

1 Like

we use in our BackendlessRequest the following FormData module https://www.npmjs.com/package/form-data and it supports using Streams and Buffers on the NodeJS env

Thanks @vladimir-upirov

The error disappears for me if I change a line of code in backendless-request/lib/index.js

var _FormData = module.exports.FormData;

into:

var _FormData = require(‘form-data’);

Not sure if this makes any sense. However it does seem to push the code now to backendless.

Hello guys,

we have an issue with deploying using node version 18.x.
An internal ticket has been created for this problem (BKNDLSS-29664).
As a workaround, you can use node v14x.

Regards

1 Like