amplify-cli: Error init environment : unexpected token 'export'
Before opening, please confirm:
- I have installed the latest version of the Amplify CLI (see above), and confirmed that the issue still persists.
- I have searched for duplicate or closed issues.
- I have read the guide for submitting bug reports.
- I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
- I have removed any sensitive information from my code snippets and submission.
How did you install the Amplify CLI?
npm
If applicable, what version of Node.js are you using?
v16.13.2
Amplify CLI Version
7.6.26
What operating system are you using?
Windows
Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.
Nothing
Amplify Categories
Not applicable
Amplify Commands
pull
Describe the bug
No changes were performed locally. Error while performing amplify pull:
✔ Successfully pulled backend environment newdev from the cloud.
✖ There was an error initializing your environment.
Unexpected token 'export'
C:\Users\**\Documents\**\code\**\src\aws-exports.js:58
export default awsmobile;
^^^^^^
SyntaxError: Unexpected token 'export'
at compileFunction (<anonymous>)
at Object.compileFunction (node:vm:352:18)
at wrapSafe (node:internal/modules/cjs/loader:1031:15)
at Module._compile (node:internal/modules/cjs/loader:1065:27)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153: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)
rc\extensions\amplify-helpers\on-category-outputs-change.ts:21:33) at initializeEnv (C:\Users\**\AppData\Roaming\npm\node_modules\@aws-amplify\cli\src\initialize-env.ts:103:27)
at runMicrotasks (<anonymous>) at processTicksAndRejections (node:internal/process/task_queues:96:5)
at pullBackend (C:\Users\**\AppData\Roaming\npm\node_modules\@aws-amplify\cli\src\pull-backend.ts:33:3) at Object.run (C:\Users\**\AppData\Roaming\npm\node_modules\@aws-amplify\cli\src\commands\pull.ts:60:7)
at Object.executeAmplifyCommand (C:\Users\**\AppData\Roaming\npm\node_modules\@aws-amplify\cli\src\index.ts:373:5) at executePluginModuleCommand (C:\Users\**\AppData\Roaming\npm\node_modules\@aws-amplify\cli\src\execution-manager.ts:178:3)
at executeCommand (C:\Users\**\AppData\Roaming\npm\node_modules\@aws-amplify\cli\src\execution-manager.ts:30:5) at Object.run (C:\Users\**\AppData\Roaming\npm\node_modules\@aws-amplify\cli\src\index.ts:205:5)
Expected behavior
Enviromnent initialized without error.
Reproduction steps
- amplify pull
GraphQL schema(s)
# Put schemas below this line
Log output
# Put your logs below this line
Additional information
aws-exports.js
/* eslint-disable */
// WARNING: DO NOT EDIT. This file is automatically generated by AWS Amplify. It will be overwritten.
const awsmobile = {
"aws_project_region": "eu-west-1",
"aws_cognito_identity_pool_id": "eu-west-1:***",
"aws_cognito_region": "eu-west-1",
"aws_user_pools_id": "eu-west-1_***",
"aws_user_pools_web_client_id": "***",
"oauth": {},
"aws_cognito_username_attributes": [
"EMAIL"
],
"aws_cognito_social_providers": [],
"aws_cognito_signup_attributes": [
"EMAIL",
"FAMILY_NAME",
"LOCALE",
"GIVEN_NAME",
"ZONEINFO"
],
"aws_cognito_mfa_configuration": "OPTIONAL",
"aws_cognito_mfa_types": [
"SMS",
"TOTP"
],
"aws_cognito_password_protection_settings": {
"passwordPolicyMinLength": 8,
"passwordPolicyCharacters": []
},
"aws_cognito_verification_mechanisms": [
"EMAIL"
],
"aws_cloud_logic_custom": [
{
"name": "AdminQueries",
"endpoint": "https://***.execute-api.eu-west-1.amazonaws.com/newdev",
"region": "eu-west-1"
},
{
"name": "***Api",
"endpoint": "https://***.execute-api.eu-west-1.amazonaws.com/newdev",
"region": "eu-west-1"
}
],
"aws_appsync_graphqlEndpoint": "https://***.appsync-api.eu-west-1.amazonaws.com/graphql",
"aws_appsync_region": "eu-west-1",
"aws_appsync_authenticationType": "AMAZON_COGNITO_USER_POOLS",
"aws_appsync_apiKey": "***",
"aws_user_files_s3_bucket": "***-newdev",
"aws_user_files_s3_bucket_region": "eu-west-1",
"aws_cognito_login_mechanisms": [
"EMAIL"
]
};
export default awsmobile;
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 20 (8 by maintainers)
Changing file to .ts worked for me.
Hi @josefaidt !! This issue is back on the latest version