Sync Changes errors, "Codeless Custom Function "funcname" error on create: this.sdkClient.codeless.createFunctionSource is not a function

Hello,

Our team is trying to set up multiple environments for staging deployments by utilizing the Sync Changes function, however we’re seeing a number of internal errors when using it, predominately errors with codeless custom functions:

06/07/2023 14:24:06 Starting change synchronization for the target app "MageCRM_QA"
06/07/2023 14:24:18 Codeless API Service "OneClickSetup", method "completeOneClickSetup" error on update: Backendless encountered an error while handling the request. An internal trouble ticket with ID 2443AEEA-4179-0683-FF06-9A6BB74ED600 has been created and we will be investigating the issue.
File system element for parameter 'file' does not exist: '/opt/backendless/repo/b9adeaa5-f56f-ab42-ff4a-502d358cce00/files/servercode/CODELESS/OneClickSetup/DRAFT/services/OneClickSetup/completeOneClickSetup.xml'
java.lang.IllegalArgumentException: File system element for parameter 'file' does not exist: '/opt/backendless/repo/b9adeaa5-f56f-ab42-ff4a-502d358cce00/files/servercode/CODELESS/OneClickSetup/DRAFT/services/OneClickSetup/completeOneClickSetup.xml'
at org.apache.commons.io.FileUtils.requireExists(FileUtils.java:2701)
at org.apache.commons.io.FileUtils.sizeOf(FileUtils.java:2822)
at controllers.files.FileManagement.lambda$fileEdit$16(FileManagement.java:423)
at com.backendless.async.BackendlessExecutorService.lambda$submit$0(BackendlessExecutorService.java:84)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)

06/07/2023 14:24:26 Codeless API Service "Permissions", method "addPermissions" error on update: Backendless encountered an error while handling the request. An internal trouble ticket with ID 7180CC87-4945-1163-FFFE-C30B641A3400 has been created and we will be investigating the issue.
File system element for parameter 'file' does not exist: '/opt/backendless/repo/b9adeaa5-f56f-ab42-ff4a-502d358cce00/files/servercode/CODELESS/Permissions/DRAFT/services/Permissions/addPermissions.xml'
java.lang.IllegalArgumentException: File system element for parameter 'file' does not exist: '/opt/backendless/repo/b9adeaa5-f56f-ab42-ff4a-502d358cce00/files/servercode/CODELESS/Permissions/DRAFT/services/Permissions/addPermissions.xml'
at org.apache.commons.io.FileUtils.requireExists(FileUtils.java:2701)
at org.apache.commons.io.FileUtils.sizeOf(FileUtils.java:2822)
at controllers.files.FileManagement.lambda$fileEdit$16(FileManagement.java:423)
at com.backendless.async.BackendlessExecutorService.lambda$submit$0(BackendlessExecutorService.java:84)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)

06/07/2023 14:24:26 Codeless API Service "Permissions", method "removePermissions" error on update: Backendless encountered an error while handling the request. An internal trouble ticket with ID EAAE3C90-BD5E-FCD9-FF7B-9A094955D800 has been created and we will be investigating the issue.
File system element for parameter 'file' does not exist: '/opt/backendless/repo/b9adeaa5-f56f-ab42-ff4a-502d358cce00/files/servercode/CODELESS/Permissions/DRAFT/services/Permissions/removePermissions.xml'
java.lang.IllegalArgumentException: File system element for parameter 'file' does not exist: '/opt/backendless/repo/b9adeaa5-f56f-ab42-ff4a-502d358cce00/files/servercode/CODELESS/Permissions/DRAFT/services/Permissions/removePermissions.xml'
at org.apache.commons.io.FileUtils.requireExists(FileUtils.java:2701)
at org.apache.commons.io.FileUtils.sizeOf(FileUtils.java:2822)
at controllers.files.FileManagement.lambda$fileEdit$16(FileManagement.java:423)
at com.backendless.async.BackendlessExecutorService.lambda$submit$0(BackendlessExecutorService.java:84)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)

06/07/2023 14:24:28 Codeless Custom Function "copyTemplate" error on create: this.sdkClient.codeless.createFunctionSource is not a function
06/07/2023 14:24:28 Codeless Custom Function "sharePropertyTypesSequence" error on create: this.sdkClient.codeless.createFunctionSource is not a function
06/07/2023 14:24:28 Codeless Custom Function "copyDirectoryObject" error on create: this.sdkClient.codeless.createFunctionSource is not a function
06/07/2023 14:24:28 Codeless Custom Function "sharePropertyGroupTypesSequence" error on create: this.sdkClient.codeless.createFunctionSource is not a function
06/07/2023 14:24:28 Codeless Custom Function "setupDefaultProperties" error on create: this.sdkClient.codeless.createFunctionSource is not a function
06/07/2023 14:24:28 Codeless Custom Function "copyCampaign" error on create: this.sdkClient.codeless.createFunctionSource is not a function
06/07/2023 14:24:28 Codeless Custom Function "addUserToMageFolder" error on create: this.sdkClient.codeless.createFunctionSource is not a function
06/07/2023 14:24:28 Codeless Custom Function "addDirectoryObjectPermissions" error on create: this.sdkClient.codeless.createFunctionSource is not a function
06/07/2023 14:24:28 Codeless Custom Function "setupNotesProperty" error on create: this.sdkClient.codeless.createFunctionSource is not a function
06/07/2023 14:24:28 Codeless Custom Function "createDataLimitForNewUser" error on create: this.sdkClient.codeless.createFunctionSource is not a function
06/07/2023 14:24:28 Codeless Custom Function "setupDummyContacts" error on create: this.sdkClient.codeless.createFunctionSource is not a function
06/07/2023 14:24:28 Codeless Custom Function "addUserToMageSupportAccounts" error on create: this.sdkClient.codeless.createFunctionSource is not a function
06/07/2023 14:24:28 Codeless Custom Function "shareDirectoryObjectsSequence" error on create: this.sdkClient.codeless.createFunctionSource is not a function
06/07/2023 14:24:28 Codeless Custom Function "copyFIleItem" error on create: this.sdkClient.codeless.createFunctionSource is not a function
06/07/2023 14:24:28 Synchronization completed.
============================================================

We are trying to migrate changes from app ID 532CF1B7-693E-48CA-B1B1-F16FCB709609 into B9ADEAA5-F56F-AB42-FF4A-502D358CCE00

Please advise as we are unsure how to proceed besides migrating these objects manually.

Thanks!

Hello @Nathan_Cousins

Thx for reporting. We found the problem. We will fix it as soon as possible.

Regards

1 Like

Hello, any updates on this? We need to create a staging environment asap

Hello @Luke_Jasudavicius,

Sorry for inconvenience.
Right now the fix is made and waiting for the stage testing, so it should appear shortly.

Regards,
Olha

Should we try again now?

Hi @Luke_Jasudavicius,

The issue has already been fixed. It is now in the testing phase, as soon as it is released and available, we will let you know in this thread. The problem will be fixed in the next release.

Regards,
Marina

Any updates on this?

Hi @Luke_Jasudavicius,

We are going to make a release with a fix for the issue reported above in the nearest time. When the fix is available, we will let you know.

Regards,
Marina

Hi @Luke_Jasudavicius,

The issue that you wrote about above has been fixed from our side. Can you confirm that everything is working as it should now?

Regards,
Marina

Hi @Marina.Kan ,

I’ve reran the migration and it appears to have mostly worked. The custom functions appear to have gone through, though there are still a few more errors that appear to be internal:

07/14/2023 14:54:02 Starting change synchronization for the target app "MageCRM_QA"
07/14/2023 14:54:13 Codeless API Service "OneClickSetup", method "completeOneClickSetup" error on update: Backendless encountered an error while handling the request. An internal trouble ticket with ID 4ABAB3BE-319C-A590-FF83-0022F4FED900 has been created and we will be investigating the issue.
File system element for parameter 'file' does not exist: '/opt/backendless/repo/b9adeaa5-f56f-ab42-ff4a-502d358cce00/files/servercode/CODELESS/OneClickSetup/DRAFT/services/OneClickSetup/completeOneClickSetup.xml'
java.lang.IllegalArgumentException: File system element for parameter 'file' does not exist: '/opt/backendless/repo/b9adeaa5-f56f-ab42-ff4a-502d358cce00/files/servercode/CODELESS/OneClickSetup/DRAFT/services/OneClickSetup/completeOneClickSetup.xml'
at org.apache.commons.io.FileUtils.requireExists(FileUtils.java:2701)
at org.apache.commons.io.FileUtils.sizeOf(FileUtils.java:2822)
at controllers.files.FileManagement.lambda$fileEdit$18(FileManagement.java:440)
at com.backendless.async.BackendlessExecutorService.lambda$submit$0(BackendlessExecutorService.java:84)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)

07/14/2023 14:54:15 Codeless API Service "Permissions", method "addPermissions" error on update: Backendless encountered an error while handling the request. An internal trouble ticket with ID 82783615-37A8-F83C-FFC4-FE0C8FD97800 has been created and we will be investigating the issue.
File system element for parameter 'file' does not exist: '/opt/backendless/repo/b9adeaa5-f56f-ab42-ff4a-502d358cce00/files/servercode/CODELESS/Permissions/DRAFT/services/Permissions/addPermissions.xml'
java.lang.IllegalArgumentException: File system element for parameter 'file' does not exist: '/opt/backendless/repo/b9adeaa5-f56f-ab42-ff4a-502d358cce00/files/servercode/CODELESS/Permissions/DRAFT/services/Permissions/addPermissions.xml'
at org.apache.commons.io.FileUtils.requireExists(FileUtils.java:2701)
at org.apache.commons.io.FileUtils.sizeOf(FileUtils.java:2822)
at controllers.files.FileManagement.lambda$fileEdit$18(FileManagement.java:440)
at com.backendless.async.BackendlessExecutorService.lambda$submit$0(BackendlessExecutorService.java:84)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)

07/14/2023 14:54:15 Codeless API Service "Permissions", method "removePermissions" error on update: Backendless encountered an error while handling the request. An internal trouble ticket with ID 55E0C136-A20F-D0F4-FFC0-AD93F577D400 has been created and we will be investigating the issue.
File system element for parameter 'file' does not exist: '/opt/backendless/repo/b9adeaa5-f56f-ab42-ff4a-502d358cce00/files/servercode/CODELESS/Permissions/DRAFT/services/Permissions/removePermissions.xml'
java.lang.IllegalArgumentException: File system element for parameter 'file' does not exist: '/opt/backendless/repo/b9adeaa5-f56f-ab42-ff4a-502d358cce00/files/servercode/CODELESS/Permissions/DRAFT/services/Permissions/removePermissions.xml'
at org.apache.commons.io.FileUtils.requireExists(FileUtils.java:2701)
at org.apache.commons.io.FileUtils.sizeOf(FileUtils.java:2822)
at controllers.files.FileManagement.lambda$fileEdit$18(FileManagement.java:440)
at com.backendless.async.BackendlessExecutorService.lambda$submit$0(BackendlessExecutorService.java:84)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)

07/14/2023 14:54:17 Synchronization completed.
============================================================

Thanks

Hi @Nathan_Cousins,

I have created an internal ticket BKNDLSS-33107 to investigate this problem. The team will take a look at it. I think it may be related to some blocks that are used in the logic of these services. We will respond to you when we get any results.

Regards,
Marina

Hi @Marina.Kan, Just curious if there has been any updates regarding this issue?

Thanks!

Hi @Nathan_Cousins

The ticket BKNDLSS-33107 is still open, and I raised the priority

Regards,
Vlad

1 Like

Hello, this is preventing us for creating a staging environment for users to test on. This is delaying the launch of our product.

Hi @Luke_Jasudavicius

Our developer is currently working on this ticket, and we will strive to fix it as soon as possible. We apologize for the inconvenience.

Regards,
Viktor

Hello @Luke_Jasudavicius,

While we’re still working on this ticket, I’ve got a workaround for you. Since some changes have already been released that allow for API services synchronization, you can give this a try: first, delete the services from the target app and then retry the synchronization. But please, make sure to back up your services first just to be safe.

Regards,
Alexander

Hi @Alexander_Pavelko,

We’ve done the workaround as you’ve suggested and it seems to have worked for the most part, though now we’re discovering that users haven’t been able to login to our app due to this error returned when logging in:

Error: Cannot find module 'codeless-function-27ec681363078266b8b2dff5fe9540fd'
Require stack:
- /opt/backendless/repo/b9adeaa5-f56f-ab42-ff4a-502d358cce00/files/servercode/CODELESS/default/PRODUCTION/handlers/user/afterLogin.js
- /usr/local/lib/node_modules/backendless-coderunner/lib/server-code/api/index.js
- /usr/local/lib/node_modules/backendless-coderunner/lib/server-code/runners/cloud-worker.js

Appears to be an internal issue with the event hook afterLogin, which I was able to find enabled in the event handlers tab. I was also able to locate the file “/servercode/CODELESS/default/PRODUCTION/handlers/user/afterLogin.js” in the files tab as well.

Is it possible that this error is related to the original codeless function migration issue?

Thank you

Hello @Nathan_Cousins!

Please give me a bit of time, and I will try to figure out what the issue is.

Regards,
Alexander

Could you please check if there are any differences in the applications now by running a “Sync changes” inspection? (synchronization is not required, only an inspection of changes)

Regards,
Alexander

Hi there,

There has been some changes we’ve made between our last migration and today so there are some differences between environment instances. One of those changes happens to be with afterLogin.

I see now that the error has changed from that module error to a code error, looking at the events there appears to be duplicates however:

/codeless/functions/2e6250ffc71a4b59ef11b528d296e5ff - newest from our other dev environment that was very recently changed (app id 532CF1B7-693E-48CA-B1B1-F16FCB709609)
/codeless/functions/98ce9c36ae59c535b1914b5488953a88 - current from our QA environment (app id B9ADEAA5-F56F-AB42-FF4A-502D358CCE00)

The error appears to be caused from that dev function, it should be running the original functions already present. I forgot to mention that the module error in my previous post is only in the QA environment.

If needed I can make a migration from our dev instance to QA instance.

EDIT: The duplicate is gone now, I’m assuming this is something you’re actively working on :slight_smile: