aws-amplify / amplify-cli

The AWS Amplify CLI is a toolchain for simplifying serverless web and mobile development.
Apache License 2.0
2.81k stars 821 forks source link

Cannot update existing project with new laptop: projectName Cannot read property 'substring' of undefined #2124

Closed heitorlessa closed 5 years ago

heitorlessa commented 5 years ago

Note: If your issue/bug is regarding the AWS Amplify Console service, please log it in the Amplify Console GitHub Issue Tracker

Describe the bug Fresh new installation of amplify CLI using Node 10 under NVM, and despite a few installation errors with gyp and zmq which I suspect is due to mock feature, I cannot run make update operations.

Project in question is: https://github.com/aws-samples/aws-serverless-airline-booking

It seems that the latest version introduced a bug where it expects IdentityPoolId, so in order to fix it I'm trying to run amplify auth update using the latest version -- As per instructions here: https://github.com/aws-amplify/amplify-cli/issues/2096

While it worker in another developer laptop, mine it doesn't - It must be some dependency that I have to install that I may not have in the new laptop.

To Reproduce Steps to reproduce the behavior:

  1. Fork https://github.com/aws-samples/aws-serverless-airline-booking
  2. Clone the fork
  3. Install latest Amplify CLI npm install -g @aws-amplify/cli
  4. Initialize the project amplify init
  5. Update Auth: amplify auth update

Expected behavior A clear and concise description of what you expected to happen.

Auth category to be updated.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Additional context

Stack error when trying to update auth, and full stack error when trying to install amplify cli.

TypeError: Cannot read property 'substring' of undefined
    at userPoolDefaults (/Users/lessa/.nvm/versions/node/v10.16.3/lib/node_modules/@aws-amplify/cli/node_modules/amplify-category-auth/provider-utils
/awscloudformation/assets/cognito-defaults.js:32:47)
    at Object.identityAndUserPoolDefaults [as identityPoolAndUserPool] (/Users/lessa/.nvm/versions/node/v10.16.3/lib/node_modules/@aws-amplify/cli/node_modules/amplify-category-auth/provider-utils/awscloudformation/assets/cognito-defaults.js:74:6)
    at serviceQuestions.then (/Users/lessa/.nvm/versions/node/v10.16.3/lib/node_modules/@aws-amplify/cli/node_modules/amplify-category-auth/provider-utils/awscloudformation/index.js:219:58)
    at process._tickCallback (internal/process/next_tick.js:68:7)
> node-gyp rebuild

  CXX(target) Release/obj.target/snappy/deps/snappy/snappy-1.1.2/snappy-sinksource.o
  CXX(target) Release/obj.target/snappy/deps/snappy/snappy-1.1.2/snappy-stubs-internal.o
  CXX(target) Release/obj.target/snappy/deps/snappy/snappy-1.1.2/snappy.o
  LIBTOOL-STATIC Release/snappy.a
  CXX(target) Release/obj.target/binding/src/binding.o
In file included from ../src/binding.cc:1:
In file included from ../src/./binding.h:6:
In file included from ../node_modules/nan/nan.h:190:
../node_modules/nan/nan_maybe_43_inl.h:88:15: error: no member named 'ForceSet' in 'v8::Object'
  return obj->ForceSet(GetCurrentContext(), key, value, attribs);
         ~~~  ^
In file included from ../src/binding.cc:1:
In file included from ../src/./binding.h:6:
../node_modules/nan/nan.h:816:18: warning: 'MakeCallback' is deprecated: Use MakeCallback(..., async_context) [-Wdeprecated-declarations]
    return node::MakeCallback(
                 ^
/Users/lessa/.node-gyp/10.16.3/include/node/node.h:176:1: note: 'MakeCallback' has been explicitly marked deprecated here
NODE_DEPRECATED("Use MakeCallback(..., async_context)",
^
/Users/lessa/.node-gyp/10.16.3/include/node/node.h:91:20: note: expanded from macro 'NODE_DEPRECATED'
    __attribute__((deprecated(message))) declarator
                   ^
In file included from ../src/binding.cc:1:
In file included from ../src/./binding.h:6:
../node_modules/nan/nan.h:830:18: warning: 'MakeCallback' is deprecated: Use MakeCallback(..., async_context) [-Wdeprecated-declarations]
    return node::MakeCallback(
                 ^
/Users/lessa/.node-gyp/10.16.3/include/node/node.h:169:1: note: 'MakeCallback' has been explicitly marked deprecated here
NODE_DEPRECATED("Use MakeCallback(..., async_context)",
^
/Users/lessa/.node-gyp/10.16.3/include/node/node.h:91:20: note: expanded from macro 'NODE_DEPRECATED'
    __attribute__((deprecated(message))) declarator
                   ^
In file included from ../src/binding.cc:1:
In file included from ../src/./binding.h:6:
../node_modules/nan/nan.h:844:18: warning: 'MakeCallback' is deprecated: Use MakeCallback(..., async_context) [-Wdeprecated-declarations]
    return node::MakeCallback(
                 ^
/Users/lessa/.node-gyp/10.16.3/include/node/node.h:162:1: note: 'MakeCallback' has been explicitly marked deprecated here
NODE_DEPRECATED("Use MakeCallback(..., async_context)",
^
/Users/lessa/.node-gyp/10.16.3/include/node/node.h:91:20: note: expanded from macro 'NODE_DEPRECATED'
    __attribute__((deprecated(message))) declarator
                   ^
In file included from ../src/binding.cc:1:
In file included from ../src/./binding.h:6:
../node_modules/nan/nan.h:1457:31: warning: 'MakeCallback' is deprecated: Use MakeCallback(..., async_context) [-Wdeprecated-declarations]
    return scope.Escape(node::MakeCallback(
                              ^
/Users/lessa/.node-gyp/10.16.3/include/node/node.h:176:1: note: 'MakeCallback' has been explicitly marked deprecated here
NODE_DEPRECATED("Use MakeCallback(..., async_context)",
^
/Users/lessa/.node-gyp/10.16.3/include/node/node.h:91:20: note: expanded from macro 'NODE_DEPRECATED'
    __attribute__((deprecated(message))) declarator
                   ^
../src/binding.cc:115:42: warning: 'ToObject' is deprecated [-Wdeprecated-declarations]
  if (node::Buffer::HasInstance(info[0]->ToObject())) {
                                         ^
/Users/lessa/.node-gyp/10.16.3/include/node/v8.h:2455:10: note: 'ToObject' has been explicitly marked deprecated here
  inline V8_DEPRECATED("Use maybe version", Local<Object> ToObject() const);
         ^
/Users/lessa/.node-gyp/10.16.3/include/node/v8config.h:327:29: note: expanded from macro 'V8_DEPRECATED'
  declarator __attribute__((deprecated))
                            ^
../src/binding.cc:116:45: warning: 'ToObject' is deprecated [-Wdeprecated-declarations]
    v8::Local<v8::Object> object = info[0]->ToObject();
                                            ^
/Users/lessa/.node-gyp/10.16.3/include/node/v8.h:2455:10: note: 'ToObject' has been explicitly marked deprecated here
  inline V8_DEPRECATED("Use maybe version", Local<Object> ToObject() const);
         ^
/Users/lessa/.node-gyp/10.16.3/include/node/v8config.h:327:29: note: expanded from macro 'V8_DEPRECATED'
  declarator __attribute__((deprecated))
                            ^
../src/binding.cc:121:27: warning: 'Utf8Value' is deprecated [-Wdeprecated-declarations]
    v8::String::Utf8Value param1(info[0]->ToString());
                          ^
/Users/lessa/.node-gyp/10.16.3/include/node/v8.h:2891:5: note: 'Utf8Value' has been explicitly marked deprecated here
    V8_DEPRECATED("Use Isolate version",
    ^
/Users/lessa/.node-gyp/10.16.3/include/node/v8config.h:327:29: note: expanded from macro 'V8_DEPRECATED'
  declarator __attribute__((deprecated))
                            ^
../src/binding.cc:142:42: warning: 'ToObject' is deprecated [-Wdeprecated-declarations]
  if (node::Buffer::HasInstance(info[0]->ToObject())) {
                                         ^
/Users/lessa/.node-gyp/10.16.3/include/node/v8.h:2455:10: note: 'ToObject' has been explicitly marked deprecated here
  inline V8_DEPRECATED("Use maybe version", Local<Object> ToObject() const);
         ^
/Users/lessa/.node-gyp/10.16.3/include/node/v8config.h:327:29: note: expanded from macro 'V8_DEPRECATED'
  declarator __attribute__((deprecated))
                            ^
../src/binding.cc:143:45: warning: 'ToObject' is deprecated [-Wdeprecated-declarations]
    v8::Local<v8::Object> object = info[0]->ToObject();
                                            ^
/Users/lessa/.node-gyp/10.16.3/include/node/v8.h:2455:10: note: 'ToObject' has been explicitly marked deprecated here
  inline V8_DEPRECATED("Use maybe version", Local<Object> ToObject() const);
         ^
/Users/lessa/.node-gyp/10.16.3/include/node/v8config.h:327:29: note: expanded from macro 'V8_DEPRECATED'
  declarator __attribute__((deprecated))
                            ^
../src/binding.cc:148:27: warning: 'Utf8Value' is deprecated [-Wdeprecated-declarations]
    v8::String::Utf8Value param1(info[0]->ToString());
                          ^
/Users/lessa/.node-gyp/10.16.3/include/node/v8.h:2891:5: note: 'Utf8Value' has been explicitly marked deprecated here
    V8_DEPRECATED("Use Isolate version",
    ^
/Users/lessa/.node-gyp/10.16.3/include/node/v8config.h:327:29: note: expanded from macro 'V8_DEPRECATED'
  declarator __attribute__((deprecated))
                            ^
../src/binding.cc:161:43: warning: 'ToObject' is deprecated [-Wdeprecated-declarations]
  v8::Local<v8::Object> object = info[0]->ToObject();
                                          ^
/Users/lessa/.node-gyp/10.16.3/include/node/v8.h:2455:10: note: 'ToObject' has been explicitly marked deprecated here
  inline V8_DEPRECATED("Use maybe version", Local<Object> ToObject() const);
         ^
/Users/lessa/.node-gyp/10.16.3/include/node/v8config.h:327:29: note: expanded from macro 'V8_DEPRECATED'
  declarator __attribute__((deprecated))
                            ^
../src/binding.cc:181:43: warning: 'ToObject' is deprecated [-Wdeprecated-declarations]
  v8::Local<v8::Object> object = info[0]->ToObject();
                                          ^
/Users/lessa/.node-gyp/10.16.3/include/node/v8.h:2455:10: note: 'ToObject' has been explicitly marked deprecated here
  inline V8_DEPRECATED("Use maybe version", Local<Object> ToObject() const);
         ^
/Users/lessa/.node-gyp/10.16.3/include/node/v8config.h:327:29: note: expanded from macro 'V8_DEPRECATED'
  declarator __attribute__((deprecated))
                            ^
../src/binding.cc:218:43: warning: 'ToObject' is deprecated [-Wdeprecated-declarations]
  v8::Local<v8::Object> object = info[0]->ToObject();
                                          ^
/Users/lessa/.node-gyp/10.16.3/include/node/v8.h:2455:10: note: 'ToObject' has been explicitly marked deprecated here
  inline V8_DEPRECATED("Use maybe version", Local<Object> ToObject() const);
         ^
/Users/lessa/.node-gyp/10.16.3/include/node/v8config.h:327:29: note: expanded from macro 'V8_DEPRECATED'
  declarator __attribute__((deprecated))
                            ^
13 warnings and 1 error generated.
make: *** [Release/obj.target/binding/src/binding.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/lessa/.nvm/versions/node/v10.16.3/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:198:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
gyp ERR! System Darwin 18.7.0
gyp ERR! command "/Users/lessa/.nvm/versions/node/v10.16.3/bin/node" "/Users/lessa/.nvm/versions/node/v10.16.3/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/lessa/.nvm/versions/node/v10.16.3/lib/node_modules/@aws-amplify/cli/node_modules/snappy
gyp ERR! node -v v10.16.3
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 

> zmq@2.15.3 install /Users/lessa/.nvm/versions/node/v10.16.3/lib/node_modules/@aws-amplify/cli/node_modules/zmq
> node-gyp rebuild

  CXX(target) Release/obj.target/zmq/binding.o
In file included from ../binding.cc:29:
/usr/local/Cellar/zeromq/4.3.2/include/zmq_utils.h:42:32: warning: unknown warning group '-Werror', ignored [-Wunknown-warning-option]
#pragma GCC diagnostic ignored "-Werror"
                               ^
/usr/local/Cellar/zeromq/4.3.2/include/zmq_utils.h:45:9: warning: Warning: zmq_utils.h is deprecated. All its functionality is provided by zmq.h.
      [-W#pragma-messages]
#pragma message(                                                               \
        ^
In file included from ../binding.cc:38:
In file included from ../node_modules/nan/nan.h:190:
../node_modules/nan/nan_maybe_43_inl.h:88:15: error: no member named 'ForceSet' in 'v8::Object'
  return obj->ForceSet(GetCurrentContext(), key, value, attribs);
         ~~~  ^
In file included from ../binding.cc:38:
../node_modules/nan/nan.h:816:18: warning: 'MakeCallback' is deprecated: Use MakeCallback(..., async_context) [-Wdeprecated-declarations]
    return node::MakeCallback(
                 ^
/Users/lessa/.node-gyp/10.16.3/include/node/node.h:176:1: note: 'MakeCallback' has been explicitly marked deprecated here
NODE_DEPRECATED("Use MakeCallback(..., async_context)",
^
/Users/lessa/.node-gyp/10.16.3/include/node/node.h:91:20: note: expanded from macro 'NODE_DEPRECATED'
    __attribute__((deprecated(message))) declarator
                   ^
In file included from ../binding.cc:38:
../node_modules/nan/nan.h:830:18: warning: 'MakeCallback' is deprecated: Use MakeCallback(..., async_context) [-Wdeprecated-declarations]
    return node::MakeCallback(
                 ^
/Users/lessa/.node-gyp/10.16.3/include/node/node.h:169:1: note: 'MakeCallback' has been explicitly marked deprecated here
NODE_DEPRECATED("Use MakeCallback(..., async_context)",
^
/Users/lessa/.node-gyp/10.16.3/include/node/node.h:91:20: note: expanded from macro 'NODE_DEPRECATED'
    __attribute__((deprecated(message))) declarator
                   ^
In file included from ../binding.cc:38:
../node_modules/nan/nan.h:844:18: warning: 'MakeCallback' is deprecated: Use MakeCallback(..., async_context) [-Wdeprecated-declarations]
    return node::MakeCallback(
                 ^
/Users/lessa/.node-gyp/10.16.3/include/node/node.h:162:1: note: 'MakeCallback' has been explicitly marked deprecated here
NODE_DEPRECATED("Use MakeCallback(..., async_context)",
^
/Users/lessa/.node-gyp/10.16.3/include/node/node.h:91:20: note: expanded from macro 'NODE_DEPRECATED'
    __attribute__((deprecated(message))) declarator
                   ^
In file included from ../binding.cc:38:
../node_modules/nan/nan.h:1457:31: warning: 'MakeCallback' is deprecated: Use MakeCallback(..., async_context) [-Wdeprecated-declarations]
    return scope.Escape(node::MakeCallback(
                              ^
/Users/lessa/.node-gyp/10.16.3/include/node/node.h:176:1: note: 'MakeCallback' has been explicitly marked deprecated here
NODE_DEPRECATED("Use MakeCallback(..., async_context)",
^
/Users/lessa/.node-gyp/10.16.3/include/node/node.h:91:20: note: expanded from macro 'NODE_DEPRECATED'
    __attribute__((deprecated(message))) declarator
                   ^
6 warnings and 1 error generated.
make: *** [Release/obj.target/zmq/binding.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/lessa/.nvm/versions/node/v10.16.3/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:198:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
gyp ERR! System Darwin 18.7.0
gyp ERR! command "/Users/lessa/.nvm/versions/node/v10.16.3/bin/node" "/Users/lessa/.nvm/versions/node/v10.16.3/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/lessa/.nvm/versions/node/v10.16.3/lib/node_modules/@aws-amplify/cli/node_modules/zmq
gyp ERR! node -v v10.16.3
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
heitorlessa commented 5 years ago

FWIW, I've also tried running amplify configure project as per other similar issues but still not working.

I suspect this may be due being a new laptop and I copied the files over. Here's the file structure just in case something is missing:

amplify
├── #current-cloud-backend
│   ├── amplify-meta.json
│   ├── api
│   │   └── awsserverlessairline
│   │       ├── build
│   │       │   ├── cloudformation-template.json
│   │       │   ├── functions
│   │       │   ├── parameters.json
│   │       │   ├── pipelineFunctions
│   │       │   ├── resolvers
│   │       │   │   ├── Booking.inboundFlight.req.vtl
│   │       │   │   ├── Booking.inboundFlight.res.vtl
│   │       │   │   ├── Booking.outboundFlight.req.vtl
│   │       │   │   ├── Booking.outboundFlight.res.vtl
│   │       │   │   ├── Mutation.createBooking.req.vtl
│   │       │   │   ├── Mutation.createBooking.res.vtl
│   │       │   │   ├── Mutation.createFlight.req.vtl
│   │       │   │   ├── Mutation.createFlight.res.vtl
│   │       │   │   ├── Mutation.deleteBooking.req.vtl
│   │       │   │   ├── Mutation.deleteBooking.res.vtl
│   │       │   │   ├── Mutation.deleteFlight.req.vtl
│   │       │   │   ├── Mutation.deleteFlight.res.vtl
│   │       │   │   ├── Mutation.updateBooking.req.vtl
│   │       │   │   ├── Mutation.updateBooking.res.vtl
│   │       │   │   ├── Mutation.updateFlight.req.vtl
│   │       │   │   ├── Mutation.updateFlight.res.vtl
│   │       │   │   ├── Query.getBooking.req.vtl
│   │       │   │   ├── Query.getBooking.res.vtl
│   │       │   │   ├── Query.getFlight.req.vtl
│   │       │   │   ├── Query.getFlight.res.vtl
│   │       │   │   ├── Query.listBookings.req.vtl
│   │       │   │   ├── Query.listBookings.res.vtl
│   │       │   │   ├── Query.listFlights.req.vtl
│   │       │   │   └── Query.listFlights.res.vtl
│   │       │   ├── schema.graphql
│   │       │   └── stacks
│   │       │       ├── Booking.json
│   │       │       ├── ConnectionStack.json
│   │       │       ├── CustomResources.json
│   │       │       └── Flight.json
│   │       ├── parameters.json
│   │       ├── resolvers
│   │       ├── schema.graphql
│   │       └── stacks
│   │           └── CustomResources.json
│   ├── auth
│   │   └── cognitoa7d29d9d
│   │       ├── cognitoa7d29d9d-cloudformation-template.yml
│   │       └── parameters.json
│   └── backend-config.json
├── aws-info.json
├── backend
│   ├── amplify-meta.json
│   ├── api
│   │   └── awsserverlessairline
│   │       ├── build
│   │       │   ├── cloudformation-template.json
│   │       │   ├── functions
│   │       │   ├── parameters.json
│   │       │   ├── pipelineFunctions
│   │       │   ├── resolvers
│   │       │   │   ├── Booking.inboundFlight.req.vtl
│   │       │   │   ├── Booking.inboundFlight.res.vtl
│   │       │   │   ├── Booking.outboundFlight.req.vtl
│   │       │   │   ├── Booking.outboundFlight.res.vtl
│   │       │   │   ├── Mutation.createBooking.req.vtl
│   │       │   │   ├── Mutation.createBooking.res.vtl
│   │       │   │   ├── Mutation.createFlight.req.vtl
│   │       │   │   ├── Mutation.createFlight.res.vtl
│   │       │   │   ├── Mutation.deleteBooking.req.vtl
│   │       │   │   ├── Mutation.deleteBooking.res.vtl
│   │       │   │   ├── Mutation.deleteFlight.req.vtl
│   │       │   │   ├── Mutation.deleteFlight.res.vtl
│   │       │   │   ├── Mutation.updateBooking.req.vtl
│   │       │   │   ├── Mutation.updateBooking.res.vtl
│   │       │   │   ├── Mutation.updateFlight.req.vtl
│   │       │   │   ├── Mutation.updateFlight.res.vtl
│   │       │   │   ├── Query.getBooking.req.vtl
│   │       │   │   ├── Query.getBooking.res.vtl
│   │       │   │   ├── Query.getFlight.req.vtl
│   │       │   │   ├── Query.getFlight.res.vtl
│   │       │   │   ├── Query.listBookings.req.vtl
│   │       │   │   ├── Query.listBookings.res.vtl
│   │       │   │   ├── Query.listFlights.req.vtl
│   │       │   │   └── Query.listFlights.res.vtl
│   │       │   ├── schema.graphql
│   │       │   └── stacks
│   │       │       ├── Booking.json
│   │       │       ├── ConnectionStack.json
│   │       │       ├── CustomResources.json
│   │       │       └── Flight.json
│   │       ├── parameters.json
│   │       ├── resolvers
│   │       ├── schema.graphql
│   │       └── stacks
│   │           └── CustomResources.json
│   ├── auth
│   │   └── cognitoa7d29d9d
│   │       ├── cognitoa7d29d9d-cloudformation-template.yml
│   │       └── parameters.json
│   ├── awscloudformation
│   │   └── nested-cloudformation-stack.yml
│   └── backend-config.json
└── team-provider-info.json
heitorlessa commented 5 years ago

Working!

Steps to solve:

  1. If you're upgrading from 1 to 3, delete project configuration: amplify/.config/aws-info.json
  2. Recreate project configuration: amplify configure project
  3. Try update operation again: amplify auth update
github-actions[bot] commented 3 years ago

This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels for those types of questions.