Realm functions in subdirectory disappear with automatic GitHub deplyment

Hi

I have a Realm app with quite a number of functions. I recently started creating some subdirectories (which I understand is a relatively new feature). Creating the subdirectories through the UI works fine - however, when I try and sync back to GitHub, all the sub directories disappear from the UI - although they are present in GitHub.

Similarly, if I create a function via GitHub, it will work as long as it isn’t in a sub-directory. If it is in a sub-directory then it just won’t appear in the UI and I won’t be able to call it.

It took me a while to track the problem down as I originally created the function for a https end-point and when syncing from GitHub I got a message in the Deployment status field saying “Failed: failed to import app: unable to find function: …”

anyone else getting this or know of any workarounds?

Hi Simon,

I recently started creating some subdirectories (which I understand is a relatively new feature). Creating the subdirectories through the UI works fine

I’m not sure what you mean by this.
Could you please provide a screenshot?

The article below states that subdirectories under /functions will not be recognised.

Regards

Hi Manny,

thank you for your response; apologies, if I didn’t explain too well. I see from the link you provided (which I hadn’t seen before) that “All of your function source code files must be in the /functions directory. Realm does not recognize functions nested in subdirectories of /functions .”

However, it also says here:

“You can define functions inside of nested folders. Function names are slash-separated paths, so a function named utils/add maps to functions/utils/add.js in the app’s configuration files.”

I found out about it from this post:

which says the sub folders work and as per the screenshot I can quite easily create a function in a sub folder from the UI and reference it in a function call.

It looks like the feature has only been part implemented. Is it possible to get a ticket raised to finish the feature off so that it works with GitHub and make the documentation consistent? The danger is that someone creates a bunch of functions in sub-folders via the UI and then tries to sync with GitHub only to lose everything.

Many thanks.

Hi Simon,

Thanks for providing a link to the documentation.
The article I referred to seems to be outdated and I will bring this to the attention of our docs team.

I was able to reproduce the behaviour you’re seeing with github auto deploy and this appears to be either a bug or unsupported in github auto deploy.

Unfortunately I did not see a potential workaround in this workflow to get around this issue but I have raised this with our Realm team to be investigated and will update this thread if there’s any progress.

Regards

1 Like

Hi Manny,

Many thanks for your investigation and raising it with the team internally.

Any updates would be much appreciated.

Regards

3 Likes

Is there any update on this issue?

Hi Surender,

There is no update on this yet.

Regards