Servercode doesn't execute async

i have an event handler that executes codeless code when a new record is added to my table “quotations” from another domain i make an post request to this table. When the request is made with less data it works fine but when the data exceeds a certain treshhold it will excecute code before an variable within this code is declared.
Screenshot 2023-04-04 at 08.07.47
it’s about the codeless above. I tried timeout and loops with timeout until being declared but it doesn’t seem to help. Hopefully the team knows the awnser, thanks in advance

Hi @Joppe_Derks

when the data exceeds a certain treshhold it will excecute code before an variable within this code is declared.

I’m not sure I got the point, could you please provide more details, perhaps add a screenshot with more logic and point out what/where exactly does not work

btw, is this a Before or After handler?

this is after i create an data item.

its mainly about getting the objectId of the item i will be adding in the table

the Before handler runs before the object is created in the DB, therefore the “objectId” is undefined

Sorry for the confusion, it’s an aftercreate handler

it works fine when the data im putting is under ±5kb. When i exceed ±5kb the code doesn’t seem to work. So the problem only seems to appear when the code is handeling more than 5kb.

What happens is that the variable objectId is not defined. Because of that the following code does not excecute properly. Is there a way to make an timeout? The wait block and setTimeOut function in a custom code block doesn’t seem to work

How can we reproduce the issue?

  1. make an api post/put request
  2. exceed 5kb in the data you want to put
  3. try to set an variable to the objectId of the response item

seems like it works for me

seems like the object wasn’t created in the db, try to print the “Response Error” context block

does not make any difference it prints out the same 15:47:47.455 | SERVER_CODE | ERROR | [376988] TypeError: Cannot read property ‘objectId’ of null at getObjectProperty (/opt/backendless/repo/49b7e3b6-7054-a807-ff2a-a5c9aaa52d00/files/servercode/CODELESS/default/PRODUCTION/handlers/persistence/quotations/afterCreate.js:7:45) at Object. (/opt/backendless/repo/49b7e3b6-7054-a807-ff2a-a5c9aaa52d00/files/servercode/CODELESS/default/PRODUCTION/handlers/persistence/quotations/afterCreate.js:33:15) at processTicksAndRejections (internal/process/task_queues.js:95:5)

did you add it as the first block?

no after i defined the objectId var

when an error occurs it stops executing next code

15:56:14.59 | SERVER_CODE | INFO | [378561] { ___jsonclass: ‘com.backendless.commons.exception.ExceptionWrapper’, ___class: ‘com.backendless.commons.exception.ExceptionWrapper’, code: 0, exceptionClass: ‘class com.backendless.exceptions.persistence.invalidentity.InvalidEntityColumnsTypeMismatchException’, exceptionMessage: ‘Unable to save object - invalid data type for properties - total_price. You can change the property type in developer console if column type allows change.’, httpStatusCode: 400 }

now i put it before everything

oh its clear now i see the total price issue

My friend its an absolute victory it works, thanks for you help i appreciate it!

glad to hear that!