Startup/server files can't access Collection Helper


I have a file to handle sending out emails in imports/startup/server. I’m trying to format the subject of the email based on info returned from a collection Helper. I.e. const subject = Document.getName().

However, I keep getting getName() is not a function in my console. I even imported the collection into the file thinking that it would need access to that, but no dice. Upon debugging it, it seems that it’s treating the Document as just an Object. Autocomplete in debugger shows only its properties and not helpers.

Any ideas on what’s going on, just seems like the file itself cannot access/find the helper function. This code is being called by the syncedcron package btw, perhaps that is the reason…?

How are you retrieving the document?

Also if you have a repo that is able to be accessed, it would be very helpful to be able to run your code to help diagnose the problem.