简体   繁体   English

无法通过 Node 18.13.0 在本地使用 Dynamodb

[英]Unable to use Dynamodb locally with Node 18.13.0

I have a problem that I do not understand.我有一个我不明白的问题。 With node 18.13.0, I am not able to use Dynamodb locally.对于节点 18.13.0,我无法在本地使用 Dynamodb。

I always get this error: "message": "UnknownEndpoint: Inaccessible host: localhost' at port 8005'. This service may not be available in the `localhost' region.", "type": 0我总是收到此错误:“消息”:“UnknownEndpoint:不可访问的主机:本地主机'在端口 8005'。此服务可能在“本地主机”区域不可用。”,“类型”:0

But with node 16 I have no problem.但是对于节点 16 我没有问题。 Here is all the information I can give you, I am on mac (m1) on Ventura 13.1 (also on windows 11).这是我可以给你的所有信息,我在 Ventura 13.1(也在 windows 11)上的 mac(m1)上。

The serveless version:无服务器版本:

  • Framework Core: 3.27.0 (local) 3.27.0 (global)框架核心:3.27.0(本地)3.27.0(全球)
  • Plugin: 6.2.3插件:6.2.3
  • SDK: 4.3.2 SDK:4.3.2

Here is my serverless.yml:这是我的 serverless.yml:

service: hydradis-planning-delivery
provider:
  name: aws
functions:
  - '${file(routes.yml)}'
plugins:
  - serverless-plugin-typescript
  - serverless-offline
  - serverless-dynamodb-local
custom:
  dynamodb:
    start:
      port: 8005
  serverless-offline:
    httpPort: 3005
    lambdaPort: 3015

Here is my connection:这是我的连接:

var dynamoDbCreation = new AWS.DynamoDB({
region: 'localhost',
endpoint: ('http://localhost:8005')
});

Can you help me?你能帮助我吗?

You should not use literal string localhost as region but rather the endpoint:您不应使用文字字符串localhost作为区域,而应使用端点:

var dynamoDbCreation = new AWS.DynamoDB({
region: 'http://127.0.0.1:8005',
endpoint: ('http://localhost:8005')
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM