Failed to upload node_modules.tar.gz: unknown: Unexpected token

I’m attempting to upload function dependencies. I’ve followed the documented steps, however I receive the following error:

Failed to upload node_modules.tar.gz: unknown: Unexpected token, expected ( (357:12) 355 | 356 | return true; > 357 | } catch { | ^ 358 | return false; 359 | } 360 | }

Is this an error with the upload process or an error inside one of the node modules? How do I go about debugging / resolving this?

@Craig_Aschbrenner Does this error reproduce consistently? If so, can you share the node_modules.tar.gz that produces this issue?

I had created a package.json with just @sveltech/ssr - npm in it. The error was consistent in both the upload and realm-cli approach to uploading it.

@Craig_Aschbrenner We took a look and the reason for this error is that the package depends on a version of babel that is higher than the version of babel we use internally to transpile the source code. We are using babel 6.26.3. Can you use a lower version ?

Hmm… good question. Is that due to one of the dependencies downstream from the main module I’m attempting to use? The @sveltech/ssr module isn’t my own so where would I look to see about using a lower babel version?

To give some context of what I’m attempting to do… @sveltech/ssr can be setup on both Netlify and Vercel (Zeit) so that “functions” can essentially deliver content in an SSR fashion. I realize a node server could be setup elsewhere and still utilize MongoDB Realm but it would be nice to utilize SSR in functions where necessary and keep everything together.

@Craig_Aschbrenner I would recommend trying an older version of the library and see if that works. Yes likely it is in a downstream dependency that you will need to check the babel version

I added babel-core to my package.json to fix the version used, rebuild the node_modules folder and then attempted to upload it again. Unfortunately the same error is persisting. @sveltech/ssr does not depend on babel and when searching through the node_modules folder none of the dependencies required a version higher than 6.26.3… however they only required a minimum of 6.26.3 in some cases.

{
  "scripts": {
    "build": "echo \"dummy build\""
  },
  "devDependencies": {
    "babel-core": "6.26.3",
    "@sveltech/ssr": "0.0.11"
  }
}

@Ian_Ward Any way you could fill me in on how MongoDB transpiles and I can try to replicate it locally to debug? I wasn’t if there was a package.json you could provide that had all of the modules / versions along with the script that does the transpiling.