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

CLI error on amplify mock api: Provided options.stopPort... #2085

Closed jacintoArias closed 4 years ago

jacintoArias commented 5 years ago

Describe the bug Followed the Angular tutorial to create one of the sample GraphQL APIs (Blog/Post/Comment sample). API and service works both in the app and remotely connecting via Graphql console (playground).

Running amplify mock api returns the following error:

Failed to start API Mock endpoint Error: Provided options.stopPort(40000is less than options.startPort (62224)

Additional context Add any other context about the problem here.

Amplify CLI version is 1.12.0 and amplify packages are

    "aws-amplify": "^1.1.36",
    "aws-amplify-angular": "^3.0.11",

running node v10.12.0 on macos 10.14

elorzafe commented 5 years ago

Thanks @jacintoArias I will transfer this issue to Amplify CLI they, will handle this issue better than me.

stefangomez commented 5 years ago

have this same issue, and other similar issues. I never got a clean install of amplify without errors though until I did the following:

  1. downgrading to node 8 (I completely uninstalled then reinstalled using nvm so that I can easily switch back).
  2. installing java from apple: link
  3. installing zmq via brew brew install zmq
  4. reinstalling amplify-cli npm install -g @aws-amplify/cli

even now with a clean install (no errors just warnings) of amplify-cli, I still get the following error: Failed to start API Mock endpoint Error: max retries hit for starting dynamodb emulator

stefangomez commented 5 years ago

I should note, I have lsof installed like mentioned here: https://github.com/aws-amplify/amplify-cli/issues/2062

Lasim commented 5 years ago

Unfortunately, I have the same problem.

Amplify: 1.12.0 Node: v12.1.0 Java: 1.8.0_201

Clean VueJS installation

    "aws-amplify": "^1.1.36",
    "aws-amplify-vue": "^0.2.14",

After running cmd amplify mock I get the following error: Failed to start API Mock endpoint Error: Provided options.stopPort(40000is less than options.startPort (62224)

RoelVanderPaal commented 5 years ago

I had the same problem. Upgrading to the latest node version (v12.8.1) using nvm solved it.

Lasim commented 5 years ago

Thanks for your message @RoelVanderPaal. I've upgraded my node version to v12.8.1

Unfortunately the problem still persist :/

yuth commented 5 years ago

We have updated the Dynamo DB simulator to use a different library to get the free port in https://github.com/aws-amplify/amplify-cli/commit/90a423cc1ecaff3dc8ebb9b5e526e1256d36d835. This should fix this problem. The change is not release yet. I will update here when the change gets release

heitorlessa commented 5 years ago

Run into similar problem which I think is related to that..tried both Node 8/10 and installing zmq didn't make much difference.

> amplify auth update

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)

Tried reinstalling amplify and noticed it fails due to zmq and some errors with gyp - Full stack error below


> 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 
playground commented 5 years ago

Getting similar issues with a fresh install, running node 10.13.0

npm install -g @aws-amplify/cli
npm WARN deprecated circular-json@0.3.3: CircularJSON is in maintenance only, flatted is its successor.
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated left-pad@1.3.0: use String.prototype.padStart()
npm WARN deprecated kleur@2.0.2: Please upgrade to kleur@3 or migrate to 'ansi-colors' if you prefer the old syntax. Visit <https://github.com/lukeed/kleur/releases/tag/v3.0.0\> for migration path(s).
npm WARN deprecated node-uuid@1.4.8: Use uuid module instead
/Users/.nvm/versions/node/v10.13.0/bin/amplify -> /Users/.nvm/versions/node/v10.13.0/lib/node_modules/@aws-amplify/cli/bin/amplify

> snappy@5.0.5 install /Users/.nvm/versions/node/v10.13.0/lib/node_modules/@aws-amplify/cli/node_modules/snappy
> node-gyp rebuild

gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR
gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR
gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR
  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:
In file included from ../node_modules/nan/nan.h:196:
In file included from ../node_modules/nan/nan_new.h:189:
../node_modules/nan/nan_implementation_12_inl.h:345:28: warning: 'New' is deprecated [-Wdeprecated-declarations]
  return v8::StringObject::New(value).As<v8::StringObject>();
                           ^
/Users/.node-gyp/10.13.0/include/node/v8.h:5052:3: note: 'New' has been explicitly marked deprecated here
  V8_DEPRECATED("Use Isolate* version",
  ^
/Users/.node-gyp/10.13.0/include/node/v8config.h:327:29: note: expanded from macro 'V8_DEPRECATED'
  declarator __attribute__((deprecated))
                            ^
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/.node-gyp/10.13.0/include/node/node.h:175:1: note: 'MakeCallback' has been explicitly marked deprecated here
NODE_DEPRECATED("Use MakeCallback(..., async_context)",
^
/Users/.node-gyp/10.13.0/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(
...
playground commented 5 years ago

Same error with node v12.9.1

henning101 commented 5 years ago

Same problems here. Tested with npm 6.9.0 and node 10.16.13/node 12.10.0

SwaySway commented 4 years ago

@playground @henning101 What is the issue you are running into? Is this error related to https://github.com/aws-amplify/amplify-cli/issues/2085#issue-482387982 or is it related to https://github.com/aws-amplify/amplify-cli/issues/2085#issuecomment-524317290?

yuth commented 4 years ago

@playground @heitorlessa @henning101 we are fixing the installation error related to NodeGyp/ZMQ in #2428

heitorlessa commented 4 years ago

Awesome! Could you ping back this thread once a new release is cut with that merge?

On Fri, 4 Oct 2019 at 06:37, Yathi notifications@github.com wrote:

@playground https://github.com/playground @heitorlessa https://github.com/heitorlessa @henning101 https://github.com/henning101 we are fixing the installation error related to NodeGyp/ZMQ in #2428 https://github.com/aws-amplify/amplify-cli/pull/2428

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/aws-amplify/amplify-cli/issues/2085?email_source=notifications&email_token=AAZPQBGTCXBGIMPVAJNPHK3QM3JC5A5CNFSM4INDDUAKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEAKPIBQ#issuecomment-538244102, or mute the thread https://github.com/notifications/unsubscribe-auth/AAZPQBHZFQNWZAYF6YOMFQDQM3JC5ANCNFSM4INDDUAA .

kaustavghosh06 commented 4 years ago

We have released a fix for this. Please comment on this thread if you're still seeing this issue.

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.