API resource body giving below error, when correct data in provided in form data

Cannot read properties of undefined (reading 'name') Getting this error, even if I have a defined value in the field.

Hey Avinash,

Seems the errors you are getting are linting errors.

Linting is the process of checking the source code for Programmatic as well as Stylistic errors . This is most helpful in identifying some common and uncommon mistakes that are made during coding.

To avoid these errors you can use optional chaining (?.) so the errors do not get thrown.

The optional chaining (?.) operator accesses an object's property or calls a function. If the object accessed or function called using this operator is undefined or null, the expression short circuits and evaluates to undefined instead of throwing an error.

In your example it would be

{{textinput1?.value}}
{{textinput2?.value}}
...

Getting a similar error, after using the optional chaining (?.) operator.
Attached ss @stefancvrkotic

For files try {{fileInput?.value}} where .value will be base64 encoded string.

You can reference file picker documentation here.

@stefancvrkotic I'm using file picker, using {{filepicker?.file}} it is giving an error.

In your example it needs to be {{filepicker3?.value}} and {{filepicker4?.value}} instead of .file

Reference example below:

For me, {{filepicker4?.value}} is giving undefined. Not sure how it is working for you. Attached ss

Can you please elaborate what component did you use for filepicker and how do you imagine the thumbnail proces to work?

Need a bit more context so I can try help you resolve this!

Used Special Inputs for file picker. We have an existing use case already running on prod.
My current use case is it should not be a mandatory field to trigger a resource query.
I believe using {{filepicker?.file}} will be Base64 encoded value. and can accept Null value too

Maybe someone from Retool team will be able to jump in and help as the 3 file input components, that I'm aware od, output .value as base64 string.

@victoria, Can you please help here?

Hey @Kabirdas, Can you help with the issue mentioned above?

Hey @Avinash_Verma! You mentioned already have a use case running on prod, are you only seeing the error when you don't have a file uploaded or is it happening all the time?

Also thanks for having jumped in here @stefancvrkotic!

Yes, we see the error when we don't have a file uploaded, i.e. we want to pass a Null value. Working fine when the file is uploaded @Kabirdas

I see, what exactly is your API expecting in the request? If you don't want to include any reference to the file field you can try dynamically specifying the key:

Does that work?