node.js - Amplify Init Error - ✖ Root stack creation failed init failed TypeError: Cannot redefine property: default - TagMerge
5Amplify Init Error - ✖ Root stack creation failed init failed TypeError: Cannot redefine property: defaultAmplify Init Error - ✖ Root stack creation failed init failed TypeError: Cannot redefine property: default

Amplify Init Error - ✖ Root stack creation failed init failed TypeError: Cannot redefine property: default

Asked 10 months ago
5
5 answers

Found solution here! github issues

Relevant quote - "I found the source of my problem... My ~/.aws/config file contained entries called [default] and [profile default], which causes the symptom."

So I removed the [default] and just left my [profile default] and then the amplify init went through normally!

Source: link

0

Amplify expects you to have had an existing user with AdministrationFullAccess. This should be confirmed before running amplify init or perhaps when you run the amplify init you will be prompted if you would be using the default AWS Profile or not. In this case, you might have to create the user yourself and attach a policy to the user and paste both the access and secret keys to the respective section on the console. But when you follow the steps to create a user with amplify configure it is so easy.

Source: link

0

I got this error when running watchify -t babelify --presets es2015 --presets react -d -e javascripts/main.jsx -o public/bundle.js -v.
Error: Cannot find module './definitions/init' while parsing file: /home/Desktop/front/javascripts/main.jsx
I have not idea what definitions/init is. My main.jsx is as follows
import Wrapper from './wrapper.js';
import React from 'react';
import { render } from 'react-dom';

render(
    <Wrapper/>,
    document.getElementById('content')
);
The primary API for rendering into the DOM looks like this:
ReactDOM.render(reactElement, domContainerNode)
Solutions
ReactDOM.render(
  <Wrapper />,
  document.getElementById('content')
);
You also need to import ReactDOM like so:
import ReactDOM from 'react-dom'

Source: link

0

Screenshots
Using default provider awscloudformation
AWS access credentials can not be detected.
? Setup new user No

For more information on AWS Profiles, see:
https://docs.aws.amazon.com/cli/latest/userguide/cli-multiple-profiles.html

? accessKeyId:   REDACTED**********
? secretAccessKey:  REDACTED********************
? region:  us-west-2
⠋ Initializing project in the cloud...An error occurred when creating the CloudFormation stack
✖ Root stack creation failed
@kaustavghosh06 I have configured amplify configure and amplify init. It has created IAM user on the console but still when I choose profile configured with AccessID and SecretKey It gives me this error. Please help me out.
Initializing project in the cloud...An error occurred when creating the CloudFormation stack
× Root stack creation failed
init failed
{ OptInRequired: The AWS Access Key Id needs a subscription for the service
    at Request.extractError (C:\Users\Admin\AppData\Roaming\npm\node_modules\@aws-amplify\cli\node_modules\amplify-provider-awscloudformation\node_modules\aws-sdk\lib\protocol\query.js:50:29)
    at Request.callListeners (C:\Users\Admin\AppData\Roaming\npm\node_modules\@aws-amplify\cli\node_modules\amplify-provider-awscloudformation\node_modules\aws-sdk\lib\sequential_executor.js:106:20)
    at Request.emit (C:\Users\Admin\AppData\Roaming\npm\node_modules\@aws-amplify\cli\node_modules\amplify-provider-awscloudformation\node_modules\aws-sdk\lib\sequential_executor.js:78:10)
    at Request.emit (C:\Users\Admin\AppData\Roaming\npm\node_modules\@aws-amplify\cli\node_modules\amplify-provider-awscloudformation\node_modules\aws-sdk\lib\request.js:683:14)
    at Request.transition (C:\Users\Admin\AppData\Roaming\npm\node_modules\@aws-amplify\cli\node_modules\amplify-provider-awscloudformation\node_modules\aws-sdk\lib\request.js:22:10)
    at AcceptorStateMachine.runTo (C:\Users\Admin\AppData\Roaming\npm\node_modules\@aws-amplify\cli\node_modules\amplify-provider-awscloudformation\node_modules\aws-sdk\lib\state_machine.js:14:12)
    at C:\Users\Admin\AppData\Roaming\npm\node_modules\@aws-amplify\cli\node_modules\amplify-provider-awscloudformation\node_modules\aws-sdk\lib\state_machine.js:26:10
    at Request.<anonymous> (C:\Users\Admin\AppData\Roaming\npm\node_modules\@aws-amplify\cli\node_modules\amplify-provider-awscloudformation\node_modules\aws-sdk\lib\request.js:38:9)
    at Request.<anonymous> (C:\Users\Admin\AppData\Roaming\npm\node_modules\@aws-amplify\cli\node_modules\amplify-provider-awscloudformation\node_modules\aws-sdk\lib\request.js:685:12)
    at Request.callListeners (C:\Users\Admin\AppData\Roaming\npm\node_modules\@aws-amplify\cli\node_modules\amplify-provider-awscloudformation\node_modules\aws-sdk\lib\sequential_executor.js:116:18)
  message: 'The AWS Access Key Id needs a subscription for the service',
  code: 'OptInRequired',
  time: 2019-03-05T13:35:57.743Z,
  requestId: '9b332cdd-3f4b-11e9-bcbc-9791fd214f40',
  statusCode: 403,
  retryable: false,
  retryDelay: 13.349160804712067 }
@kaustavghosh06 I have configured amplify configure and amplify init. It has created IAM user on the console but still when I choose profile configured with AccessID and SecretKey It gives me this error. Please help me out.
Initializing project in the cloud...An error occurred when creating the CloudFormation stack
× Root stack creation failed
init failed
{ OptInRequired: The AWS Access Key Id needs a subscription for the service
    at Request.extractError (C:\Users\Admin\AppData\Roaming\npm\node_modules\@aws-amplify\cli\node_modules\amplify-provider-awscloudformation\node_modules\aws-sdk\lib\protocol\query.js:50:29)
    at Request.callListeners (C:\Users\Admin\AppData\Roaming\npm\node_modules\@aws-amplify\cli\node_modules\amplify-provider-awscloudformation\node_modules\aws-sdk\lib\sequential_executor.js:106:20)
    at Request.emit (C:\Users\Admin\AppData\Roaming\npm\node_modules\@aws-amplify\cli\node_modules\amplify-provider-awscloudformation\node_modules\aws-sdk\lib\sequential_executor.js:78:10)
    at Request.emit (C:\Users\Admin\AppData\Roaming\npm\node_modules\@aws-amplify\cli\node_modules\amplify-provider-awscloudformation\node_modules\aws-sdk\lib\request.js:683:14)
    at Request.transition (C:\Users\Admin\AppData\Roaming\npm\node_modules\@aws-amplify\cli\node_modules\amplify-provider-awscloudformation\node_modules\aws-sdk\lib\request.js:22:10)
    at AcceptorStateMachine.runTo (C:\Users\Admin\AppData\Roaming\npm\node_modules\@aws-amplify\cli\node_modules\amplify-provider-awscloudformation\node_modules\aws-sdk\lib\state_machine.js:14:12)
    at C:\Users\Admin\AppData\Roaming\npm\node_modules\@aws-amplify\cli\node_modules\amplify-provider-awscloudformation\node_modules\aws-sdk\lib\state_machine.js:26:10
    at Request.<anonymous> (C:\Users\Admin\AppData\Roaming\npm\node_modules\@aws-amplify\cli\node_modules\amplify-provider-awscloudformation\node_modules\aws-sdk\lib\request.js:38:9)
    at Request.<anonymous> (C:\Users\Admin\AppData\Roaming\npm\node_modules\@aws-amplify\cli\node_modules\amplify-provider-awscloudformation\node_modules\aws-sdk\lib\request.js:685:12)
    at Request.callListeners (C:\Users\Admin\AppData\Roaming\npm\node_modules\@aws-amplify\cli\node_modules\amplify-provider-awscloudformation\node_modules\aws-sdk\lib\sequential_executor.js:116:18)
  message: 'The AWS Access Key Id needs a subscription for the service',
  code: 'OptInRequired',
  time: 2019-03-05T13:35:57.743Z,
  requestId: '9b332cdd-3f4b-11e9-bcbc-9791fd214f40',
  statusCode: 403,
  retryable: false,
  retryDelay: 13.349160804712067 }
I'm having this issue, @kaustavghosh06 and I just installed amplify cli minutes ago.
$ npm -v @aws-amplify/cli
6.9.0
e:
? Please choose the profile you want to use default
⠼ Initializing project in the cloud...An error occurred when creating the CloudFormation stack
✖ Root stack creation failed
init failed
OptInRequired: The AWS Access Key Id needs a subscription for the service
    at Request.extractError (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/protocol/query.js:50:29)
    at Request.callListeners (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/sequential_executor.js:106:20)
    at Request.emit (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/sequential_executor.js:78:10)
    at Request.emit (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:683:14)
    at Request.transition (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:22:10)
    at AcceptorStateMachine.runTo (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/state_machine.js:14:12)
    at /usr/local/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/state_machine.js:26:10
    at Request.<anonymous> (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:38:9)
    at Request.<anonymous> (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:685:12)
    at Request.callListeners (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/sequential_executor.js:116:18) {
  message: 'The AWS Access Key Id needs a subscription for the service',
  code: 'OptInRequired',
  time: 2019-05-28T19:58:07.929Z,
  requestId: 'ead638e5-8182-11e9-a06b-49b3e1023431',
  statusCode: 403,
  retryable: false,
  retryDelay: 48.43216643197701
}

Source: link

0

"UserDashboard": {
            "name": "UserDashboard",
            "fields": {
                "id": {
                    "name": "id",
                    "isArray": false,
                    "type": "ID",
                    "isRequired": true,
                    "attributes": []
                },
                "user": {
                    "name": "user",
                    "isArray": false,
                    "type": {
                        "model": "User"
                    },
                    "isRequired": true,
                    "attributes": [],
                    "association": {
                        "connectionType": "BELONGS_TO",
                        "targetName": "id"
                    }
                },
                "dashboard": {
                    "name": "dashboard",
                    "isArray": false,
                    "type": {
                        "model": "Dashboard"
                    },
                    "isRequired": true,
                    "attributes": [],
                    "association": {
                        "connectionType": "BELONGS_TO",
                        "targetName": "id"
                    }
                }
            }
let dashboard = await DataStore.save(
        new Dashboard({
          DashboardId: "testDashboard",
          createdAt: new Date().toISOString()
        })
      )

    let user = await DataStore.save(
      new User({
        UserId: "testUserId",
        createdAt: new Date().toISOString()
      })
    )

    let userDashboard = await DataStore.save(
      new UserDashboard({
        user: user.id,
        dashboard: dashboard.id
      })
    )

Source: link

Recent Questions on node.js

    Programming Languages