错误:uncaughtException:provider.getConfiguredPinpointClient不是函数

时间:2019-01-22 01:41:42

标签: aws-amplify

复制步骤:

  1. 导航到放大项目目录。
  2. 运行amplify notifications add
  3. 选择您想要给您的精确项目命名的任何名称
  4. 选择电子邮件

问题:

对于aws-amplify,在运行amplify notifications add时导致以下错误的原因是什么?

  

错误:uncaughtException:provider.getConfiguredPinpointClient不是函数

日志:

amplify notifications add
? Choose the push notification channel to enable. Email
An Amazon Pinpoint project will be created for notifications.
    ? Pinpoint project name kbdlist
    2019-01-22T01:10:48.293Z - error: uncaughtException: provider.getConfiguredPinpointClient is not a function date=Mon Jan 21 2019 18:10:48 GMT-0700 (Mountain Standard Time), pid=35163, uid=501, gid=20, cwd=/Users/blakedietz/projects/kbdlist/kbdlist.com, execPath=/Users/blakedietz/.nvm/versions/node/v11.5.0/bin/node, version=v11.5.0, argv=[/Users/blakedietz/.nvm/versions/node/v11.5.0/bin/node, /Users/blakedietz/.nvm/versions/node/v11.5.0/bin/amplify, notifications, add], rss=144945152, heapTotal=115912704, heapUsed=73400600, external=587915, loadavg=[8.3427734375, 6.7333984375, 6.1748046875], uptime=803682, trace=[column=19, file=/Users/blakedietz/.nvm/versions/node/v11.5.0/lib/node_modules/@aws-amplify/cli/node_modules/amplify-category-notifications/lib/pinpoint-helper.js, function=getPinpointClient, line=228, method=null, native=false, column=32, file=/Users/blakedietz/.nvm/versions/node/v11.5.0/lib/node_modules/@aws-amplify/cli/node_modules/amplify-category-notifications/lib/pinpoint-helper.js, function=createApp, line=153, method=null, native=false, column=29, file=/Users/blakedietz/.nvm/versions/node/v11.5.0/lib/node_modules/@aws-amplify/cli/node_modules/amplify-category-notifications/lib/pinpoint-helper.js, function=createPinpointApp, line=69, method=null, native=false, column=7, file=internal/process/next_tick.js, function=process.internalTickCallback, line=77, method=internalTickCallback, native=false], stack=[TypeError: provider.getConfiguredPinpointClient is not a function,     at getPinpointClient (/Users/blakedietz/.nvm/versions/node/v11.5.0/lib/node_modules/@aws-amplify/cli/node_modules/amplify-category-notifications/lib/pinpoint-helper.js:228:19),     at createApp (/Users/blakedietz/.nvm/versions/node/v11.5.0/lib/node_modules/@aws-amplify/cli/node_modules/amplify-category-notifications/lib/pinpoint-helper.js:153:32),     at createPinpointApp (/Users/blakedietz/.nvm/versions/node/v11.5.0/lib/node_modules/@aws-amplify/cli/node_modules/amplify-category-notifications/lib/pinpoint-helper.js:69:29),     at process.internalTickCallback (internal/process/next_tick.js:77:7)]


1 个答案:

答案 0 :(得分:0)

原因:

这是由于您的project-config.json键中的providers路径不正确引起的。如果您使用多台计算机或nvmn之类的节点版本管理器,则可能会发生这种情况,因为您的路径可能会从添加到您的providers键中的初始​​路径改变project-config.json

解决方案:

providers路径更改为安装了@aws-amplify/cli软件包的路径。

例如,在发生错误之前,我的提供者值是

{
    ...
    "providers": {
        "awscloudformation": "/Users/blakedietz/.nvm/versions/node/v11.0.0/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation"
    }
}

所以我将值从v11.0.0更新为v11.5.0,如下所示:

{
    ...
    "providers": {
        "awscloudformation": "/Users/blakedietz/.nvm/versions/node/v11.5.0/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation"
    }
}