Apple App Store Server Node.js Library does not work in Atlas functions

Hi MongoDB Support,

For my project, I need to use the Apple App Store Server Node.js Library in Atlas functions. I installed the package for use by Atlas functions and tried using it, but got the following error when instantiating a SignedDataVerifier object: {"message":"Value is not an object: undefined","name":"TypeError"}.

I looked into this, and it appears the problem is likely that the App Store Server Library uses the jsonwebtoken package version 9, because according to the MongoDB Community Forum post Functions on Node 10?, the jsonwebtoken package version 9 does not work with Atlas functions, and instead you must use version 8. But I have no control over which version of jsonwebtoken the package uses.

I later came across this feedback item: Upgrade Node.js version (from v10 to v14/v16), where it looks like the root of the problem is the App Store Server Library requires Node 16+, but Atlas functions only support Node 10 and earlier.

In the meantime, until you guys support Node 16, is there anything I can do to be able to use this package? This is a major issue for us, since we need this package in order to set up in-app purchases for our iOS app, so our company can start making revenue!

Thank you,
Elias

For anyone else who’s come across the issue, unfortunately we found the only real option was to set up a server somewhere else to run the App Store Server Library. Then, you pass on the decoded and verified information from this server to your Atlas App Services app. We personally did this by setting up an AWS Lambda function to run the library.

This admittedly sucks, but for anyone who’s using Atlas App Services for a serious app, it seems inevitable that you might need to set up another server to run SDKs that aren’t compatible with Atlas functions.