parse-community / parse-community/parse-server
Cannot use import statement outside a module
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 21.4k
- Forks
- 4.8k
- Avg merge
- 7h 45m
- Merged PRs (30d)
- 11
Description
New Issue Checklist
- I am not disclosing a vulnerability.
- I am not just asking a question.
- I have searched through existing issues.
- I can reproduce the issue with the latest version of Parse Server.
Issue Description
When running cmd : parse-server --appId APPLICATION_ID --clientKey CLIENT_KEY --masterKey MASTER_KEY --databaseURI mongodb://localhost/test I get error as mentioned in the title
Steps to reproduce
Run parse-server --appId APPLICATION_ID --clientKey CLIENT_KEY --masterKey MASTER_KEY --databaseURI mongodb://localhost/test and use es6(import/export)
Actual Outcome
Getting error
`import { CreateUserRequestModel } from "models/users/UserModels";
^^^^^^
SyntaxError: Cannot use import statement outside a module
at compileFunction ()
at Object.compileFunction (node:vm:352:18)
at wrapSafe (node:internal/modules/cjs/loader:1033:15)
at Module._compile (node:internal/modules/cjs/loader:1069:27)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)`
Expected Outcome
Should compile
Environment
4.5.0
Server
- Parse Server version:
4.5.0 - Operating system:
windows 11 - Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc):
local cloud-code
Database
- System (MongoDB or Postgres):
MongoDB - Database version:
4.8.1 - Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc):
local mongodb-runner
Client
- SDK (iOS, Android, JavaScript, PHP, Unity, etc):
javascript - SDK version:
2.2.5
Logs
warn: DeprecationWarning: The Parse Server option 'directAccess' default will change to 'true' in a future version. Additionally, the environment variable 'PARSE_SERVER_ENABLE_EXPERIMENTAL_DIRECT_ACCESS' will be deprecated and renamed to 'PARSE_SERVER_DIRECT_ACCESS' in a future version; it is currently possible to use either one.
warn: DeprecationWarning: The Parse Server option 'enforcePrivateUsers' default will change to 'true' in a future version.
C:\source\teach_and_learn_teacher\Teach_And_Learn_B4A_Cloud_Code\cloud\controllers\teachersControllers\createUserTeacher.ts:1
import { CreateUserRequestModel } from "models/users/UserModels";
^^^^^^
SyntaxError: Cannot use import statement outside a module
at compileFunction ()
at Object.compileFunction (node:vm:352:18)
at wrapSafe (node:internal/modules/cjs/loader:1033:15)
at Module._compile (node:internal/modules/cjs/loader:1069:27)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object. (C:\source\teach_and_learn_teacher\Teach_And_Learn_B4A_Cloud_Code\cloud\main.ts:2:1)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the reported parse-server command and the cloud-code entry points cloud/main.ts and cloud/controllers/teachersControllers/createUserTeacher.ts. Investigate how Parse Server loads these TypeScript and ES6 import/export files, then reproduce the failure with the stated MongoDB setup. Done means the cloud code starts without the module syntax error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js, typescript
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100