1

目标

我正在尝试使用以下命令在本地启动 Dynamodb

yarn start:beta 

哪个调用此脚本

source ./scripts/prod-assumerole.sh && SLS_DEBUG=* sls offline start --region us-east-1 --stage local-beta --inMemory true --migrate true  --seed local --noAuth true --dontPrintOutput

问题

此调用失败,并出现本文末尾链接的错误。如果我导航到 localhost:8000/shell,aws 本地已加载,但没有表。

以前的尝试

  • 我们尝试过使用不同版本的java。当前版本是 13.0.2
  • 我们尝试删除 node_modules 文件夹和 .dynamodb 文件夹,然后使用 yarn 重新安装它们
  • 我们确认已安装无服务器(版本信息如下)
Serverless: Running "serverless" installed locally (in service node_modules)
Framework Core: 1.54.0
Plugin: 3.1.2
SDK: 2.1.2
Components Core: 1.1.1
Components CLI: 1.4.0

问题

有谁知道可能导致此错误的原因?
或者有没有人有任何故障排除的想法?

错误信息

UnknownError: Not Found: DynamoDB - Error - 
 
  Unknown Error ------------------------------------------
 
  UnknownError: Not Found
      at Request.extractError (/Users/myUser/Documents/GitHub/myRepoName/node_modules/serverless-dynamodb-local/node_modules/aws-sdk/lib/protocol/json.js:48:27)
      at Request.callListeners (/Users/myUser/Documents/GitHub/myRepoName/node_modules/serverless-dynamodb-local/node_modules/aws-sdk/lib/sequential_executor.js:105:20)
      at Request.emit (/Users/myUser/Documents/GitHub/myRepoName/node_modules/serverless-dynamodb-local/node_modules/aws-sdk/lib/sequential_executor.js:77:10)
      at Request.emit (/Users/myUser/Documents/GitHub/myRepoName/node_modules/serverless-dynamodb-local/node_modules/aws-sdk/lib/request.js:683:14)
      at Request.transition (/Users/myUser/Documents/GitHub/myRepoName/node_modules/serverless-dynamodb-local/node_modules/aws-sdk/lib/request.js:22:10)
      at AcceptorStateMachine.runTo (/Users/myUser/Documents/GitHub/myRepoName/node_modules/serverless-dynamodb-local/node_modules/aws-sdk/lib/state_machine.js:14:12)
      at /Users/myUser/Documents/GitHub/myRepoName/node_modules/serverless-dynamodb-local/node_modules/aws-sdk/lib/state_machine.js:26:10
      at Request.<anonymous> (/Users/myUser/Documents/GitHub/myRepoName/node_modules/serverless-dynamodb-local/node_modules/aws-sdk/lib/request.js:38:9)
      at Request.<anonymous> (/Users/myUser/Documents/GitHub/myRepoName/node_modules/serverless-dynamodb-local/node_modules/aws-sdk/lib/request.js:685:12)
      at Request.callListeners (/Users/myUser/Documents/GitHub/myRepoName/node_modules/serverless-dynamodb-local/node_modules/aws-sdk/lib/sequential_executor.js:115:18)
      at Request.emit (/Users/myUser/Documents/GitHub/myRepoName/node_modules/serverless-dynamodb-local/node_modules/aws-sdk/lib/sequential_executor.js:77:10)
      at Request.emit (/Users/myUser/Documents/GitHub/myRepoName/node_modules/serverless-dynamodb-local/node_modules/aws-sdk/lib/request.js:683:14)
      at Request.transition (/Users/myUser/Documents/GitHub/myRepoName/node_modules/serverless-dynamodb-local/node_modules/aws-sdk/lib/request.js:22:10)
      at AcceptorStateMachine.runTo (/Users/myUser/Documents/GitHub/myRepoName/node_modules/serverless-dynamodb-local/node_modules/aws-sdk/lib/state_machine.js:14:12)
      at /Users/myUser/Documents/GitHub/myRepoName/node_modules/serverless-dynamodb-local/node_modules/aws-sdk/lib/state_machine.js:26:10
      at Request.<anonymous> (/Users/myUser/Documents/GitHub/myRepoName/node_modules/serverless-dynamodb-local/node_modules/aws-sdk/lib/request.js:38:9)
      at Request.<anonymous> (/Users/myUser/Documents/GitHub/myRepoName/node_modules/serverless-dynamodb-local/node_modules/aws-sdk/lib/request.js:685:12)
      at Request.callListeners (/Users/myUser/Documents/GitHub/myRepoName/node_modules/serverless-dynamodb-local/node_modules/aws-sdk/lib/sequential_executor.js:115:18)
      at callNextListener (/Users/myUser/Documents/GitHub/myRepoName/node_modules/serverless-dynamodb-local/node_modules/aws-sdk/lib/sequential_executor.js:95:12)
      at IncomingMessage.onEnd (/Users/myUser/Documents/GitHub/myRepoName/node_modules/serverless-dynamodb-local/node_modules/aws-sdk/lib/event_listeners.js:269:13)
      at IncomingMessage.emit (events.js:215:7)
      at IncomingMessage.EventEmitter.emit (domain.js:475:20)
      at endReadableNT (_stream_readable.js:1184:12)
      at processTicksAndRejections (internal/process/task_queues.js:80:21)
  From previous event:
      at PluginManager.invoke (/Users/myUser/Documents/GitHub/myRepoName/node_modules/serverless/lib/classes/PluginManager.js:505:22)
      at /Users/myUser/Documents/GitHub/myRepoName/node_modules/serverless/lib/classes/PluginManager.js:540:24
  From previous event:
      at PluginManager.run (/Users/myUser/Documents/GitHub/myRepoName/node_modules/serverless/lib/classes/PluginManager.js:540:8)
      at /Users/myUser/Documents/GitHub/myRepoName/node_modules/serverless/lib/Serverless.js:115:33
      at processImmediate (internal/timers.js:439:21)
      at process.topLevelDomainCallback (domain.js:130:23)
  From previous event:
      at Serverless.run (/Users/myUser/Documents/GitHub/myRepoName/node_modules/serverless/lib/Serverless.js:102:74)
      at /Users/myUser/Documents/GitHub/myRepoName/node_modules/serverless/bin/serverless.js:72:30
      at /Users/myUser/Documents/GitHub/myRepoName/node_modules/serverless/node_modules/fs-extra/node_modules/graceful-fs/graceful-fs.js:111:16
      at /Users/myUser/Documents/GitHub/myRepoName/node_modules/serverless/node_modules/graceful-fs/graceful-fs.js:111:16
      at /Users/myUser/Documents/GitHub/myRepoName/node_modules/archiver-utils/node_modules/graceful-fs/graceful-fs.js:43:10
      at /Users/myUser/Documents/GitHub/myRepoName/node_modules/decompress/node_modules/graceful-fs/graceful-fs.js:43:10
      at /Users/myUser/Documents/GitHub/myRepoName/node_modules/write-file-atomic/node_modules/graceful-fs/graceful-fs.js:43:10
      at /Users/myUser/Documents/GitHub/myRepoName/node_modules/serverless/node_modules/write-file-atomic/node_modules/graceful-fs/graceful-fs.js:43:10
      at /Users/myUser/Documents/GitHub/myRepoName/node_modules/@serverless/platform-sdk/node_modules/graceful-fs/graceful-fs.js:43:10
      at /Users/myUser/Documents/GitHub/myRepoName/node_modules/serverless/node_modules/graceful-fs/graceful-fs.js:45:10
      at FSReqCallback.oncomplete (fs.js:146:23)
  From previous event:
      at /Users/myUser/Documents/GitHub/myRepoName/node_modules/serverless/bin/serverless.js:72:8
      at processImmediate (internal/timers.js:439:21)
      at process.topLevelDomainCallback (domain.js:130:23)
  From previous event:
      at Object.<anonymous> (/Users/myUser/Documents/GitHub/myRepoName/node_modules/serverless/bin/serverless.js:57:4)
      at Module._compile (internal/modules/cjs/loader.js:959:30)
      at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
      at Module.load (internal/modules/cjs/loader.js:815:32)
      at Function.Module._load (internal/modules/cjs/loader.js:727:14)
      at Function.Module.runMain (internal/modules/cjs/loader.js:1047:10)
      at internal/main/run_main_module.js:17:11
 
4

1 回答 1

0

我们发现我不小心修改了我的 /etc/hosts 文件并删除了对 localhost 的引用。
在我重新添加以下内容后,我能够毫无问题地启动 dynamodblocal:

127.0.0.1    localhost
255.255.255.255 broadcasthost
::1       localhost

我们通过在连接和不连接我的 vpn 的情况下测试启动 dynamodblocal 发现了这个问题。它在未连接时工作,但在连接时失败(并且 localhost:3000 无法解析并显示错误)。这促使我们检查确实缺少这些引用的“etc/hosts”文件。

于 2020-12-16T21:36:24.007 回答