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:

https://www.mongodb.com/docs/realm/functions/define-a-function/

“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

Hi Manny,
Experiencing same issue, any updates or any work around.

@Mansoor_Omar Any update on this?! I’m amazed that ten months later, this still exists. The issue was well-documented above, showing inconsistent documentation and broken functionality on your product. I just wasted hours trying to debug this until finding this thread.

Are you understanding that your UI (still) says “Use forward slashes to denote nesting in the Functions directory…” when creating the function, but then they never show in that very same UI?

Are you no longer officially supporting GitHub deployments?? Is this getting fixed, and/or is there any workaround?

Thanks.

1 Like

Hi All,

There is no update on this yet but I will follow it up with our product team.

Regards
Manny

1 Like

This is still an issue. It would be nice to at least see clarification in the admin UI text where it says subfolders are supported.

@Mansoor_Omar

re:

There is no update on this yet but I will follow it up with our product team.

Where are we with this? If Functions are meant to be a key aspect of MongoDB Atlas, then it should support something as simple as grouping under folders. Projects could have dozens or hundreds of functions, and it needs to be more manageable.

Thanks.

Hi All,

Apologies for the delay however the good news is our team have a fix for this issue which will should be released in a week or so.

I will update again when the fix is deployed.

Regards
Manny

Looking forward to this getting fixed. I’ve been using a clunky workaround of naming my functions with underscores to represent the directory structure to help me find stuff. It will be great to finally tidy up the mess I have created.

@ConstantSphere @Gregory_Fay @Surender_Kumar @Tekeleselassie_Leul @Eric_Summers

Thank you for your patience on this, I’m pleased to announce that the fix for this issue has been released today!

Please test and let us know if there are any problems.

Regards
Manny

1 Like

@Mansoor_Omar Thank you, sir! Preliminary testing has this working great!

1 Like

I can also confirm that this is now working for me. Many thanks for your efforts on this. As a side note it would be good to show the functions in their folder structure within the UI (as you do in the hosting UI) but this is more of an enhancement than a defect. Thanks again!

1 Like

Hi Simon,

Good to hear it’s working now!

As a side note it would be good to show the functions in their folder structure within the UI (as you do in the hosting UI) but this is more of an enhancement than a defect.

I would recommend raising this in our feedback portal.
https://feedback.mongodb.com/forums/945334-atlas-app-services

Regards