You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Cannot specify cloud file string using ES Module #7559
🚀 You can help us to fix this issue faster by opening a pull request with a failing test. See our Contribution Guide for how to make a pull request, or read our New Contributor's Guide if this is your first time contributing.
@Moumouls Can we merge #7560 again? Your comment led to a revert, but since Parse Server 6 supports an async start, the issue your mentioned should be solved and we can merge this, right?
There is also #7914 and #8232, but I believe that the issue here hasn't been addressed in these. If so, then we'd just have to reopen #7560 and merge, maybe with some slight modifications.
I was able to reproduce the issue with Parse Server 6.5.0-beta.1 where setting a ESM for the cloud property of Parse Server throws the error:
Error [ERR_REQUIRE_ESM]: require() of ES Module main.js from node_modules/parse-server/lib/ParseServer.js not supported.
Instead change the require of main.js in node_modules/parse-server/lib/ParseServer.js to a dynamic import() which is available in all CommonJS modules.
The fix integrated in #7560 relies on process.env.npm_package_type being set to module, so in my case when I start Parse Server via node index.js I get:
process.env.npm_package_type: undefined and therefore Parse Server falls back to require.
The variable npm_package_type is coming from npm. But anyway logic depending on it is rather unreliable and we better document it properly somewhere :)
I was able to workaround this by hardcoding the value in my K8S deployment where I actually start node directly like this:
I can confirm that after switching the K8S deployment to use npm start to start the Parse Server, the npm_package_type is properly set to module and ParseServer starts using import instead of require.
Now that I think about it it makes sense, as starting the app directly via node probably completely ignores the package.json, whereas using npm start actually infers the module type from `package.json.
The variable npm_package_type is coming from npm. But anyway logic depending on it is rather unreliable and we better document it properly somewhere :)
I was able to workaround this by hardcoding the value in my K8S deployment where I actually start node directly like this:
Activity
parse-github-assistant commentedon Sep 9, 2021
Thanks for opening this issue!
mtrezza commentedon Sep 14, 2021
Closed via #7560
mtrezza commentedon Nov 12, 2023
@Moumouls Can we merge #7560 again? Your comment led to a revert, but since Parse Server 6 supports an async start, the issue your mentioned should be solved and we can merge this, right?
There is also #7914 and #8232, but I believe that the issue here hasn't been addressed in these. If so, then we'd just have to reopen #7560 and merge, maybe with some slight modifications.
mtrezza commentedon Nov 15, 2023
@dblythy Is this issue already resolved?
mtrezza commentedon Nov 17, 2023
I was able to reproduce the issue with Parse Server 6.5.0-beta.1 where setting a ESM for the
cloudproperty of Parse Server throws the error:Issue reopened.
mman commentedon Oct 9, 2024
The fix integrated in #7560 relies on
process.env.npm_package_typebeing set tomodule, so in my case when I start Parse Server vianode index.jsI get:process.env.npm_package_type: undefinedand therefore Parse Server falls back torequire.mman commentedon Oct 9, 2024
The variable
npm_package_typeis coming fromnpm. But anyway logic depending on it is rather unreliable and we better document it properly somewhere :)I was able to workaround this by hardcoding the value in my K8S deployment where I actually start node directly like this:
and then the parse server starts again.
mman commentedon Oct 14, 2024
I can confirm that after switching the K8S deployment to use
npm startto start the Parse Server, thenpm_package_typeis properly set tomoduleand ParseServer starts usingimportinstead ofrequire.Now that I think about it it makes sense, as starting the app directly via
nodeprobably completely ignores thepackage.json, whereas usingnpm startactually infers the module type from `package.json.djdannycastillo commentedon Dec 7, 2024
@mman you've saved me a lot of time with this. I definitely agree with you on documenting this somewhere.