files.updateFileDescriptor

Question:
[‘INVALID_ARGUMENT: “options.fieldMask” must be an array’]

Product:
[Wix Editor]

I need some help understanding and solving this problem.

const elevatedUpdateFileDescriptor = elevate(files.updateFileDescriptor);
const updatedDescriptor = await elevatedUpdateFileDescriptor("5317ff_ae2c6739800d4097a0f1829febe7e43a~mv2.jpg", 
															 {parentFolderId:"c64ecde445c24a36b55eb783b283d83b"});

Trace: MoveFileToDestinationFolder Error: message: ‘INVALID_ARGUMENT: “options.fieldMask” must be an array’
details:
validationError:
fieldViolations:
- field: options.fieldMask
description: must be an array
at buildError (/dynamic-modules/edm_root/2f603477-b7fb-42d2-b5db-1388b1c71a9e/node_modules/@wix/motion-edm-autogen-transformations/src/lib/transformations/transformError/index.ts:44:17)

“option.fieldMask must be an array” ??? Which parameter is wrong?

I read the documentation, and it seemed to me that everything was very clear, where am I going wrong?
Please help me

Please help…

elevatedUpdateFileDescriptor = elevate(files.updateFileDescriptor);
const updatedDescriptor = await elevatedUpdateFileDescriptor(“5317ff_ae2c6739800d4097a0f1829febe7e43a~mv2.jpg”, {parentFolderId:“c64ecde445c24a36b55eb783b283d83b”});

Trace: Error: message: ‘INVALID_ARGUMENT: “options.fieldMask” must be an array’
[/quote]

The problem lies in the way the elevateUpdateFileDescriptor function is being called. It seems like the function expects an array as the second argument (options ) but it’s being provided with a single string value.

Let’s break down the code and the error:

  • elevatedUpdateFileDescriptor likely takes two arguments:
    • The first argument is the file descriptor ("5317ff_ae2c6739800d4097a0f1829febe7e43a~mv2.jpg" in this case).
    • The second argument (options ) is supposed to be an object containing additional options for updating the file. However, it’s currently provided as a string ({parentFolderId:“c64ecde445c24a36b55eb783b283d83b”} )
  • The error message indicates that the options argument ({parentFolderId:“c64ecde445c24a36b55eb783b283d83b”} ) is invalid because it’s a string, but the function expects it to be an array.

Here’s how to fix the problem:

  1. Convert the string containing the option (parentFolderId ) into a proper object:
const options = {
  parentFolderId: "c64ecde445c24a36b55eb783b283d83b",
  fieldMask: [],
};

Pass the options object as the second argument to elevatedUpdateFileDescriptor :

const updatedDescriptor = await elevatedUpdateFileDescriptor(
  "5317ff_ae2c6739800d4097a0f1829febe7e43a~mv2.jpg",
  options
);

By making these changes, you should be providing the function with the data it expects in the correct format.

HI,
unfortunately the result does not change.

I’m sorry to hear we couldn’t assist you with this code.
While it’s not our area of primary expertise, perhaps someone else in our community can help identify the issue. :disappointed:

HI,
Thanks anyway for your support.
What’s strange is that fieldMask: is not one of the possible parameters for this function. Very, very strange.
Thank you

1 Like

Hi,

Do you have updates on this topic?
I’ve got the same problem.

Thank you