0

I'm trying to use DynamoDB Local. It works perfectly fine using the AWS CLI, but when I try to use it with the AWS SDK in Node, I keep getting a "Method Not Allowed" error. The same code works perfectly fine with the real DynamoDB, so I know it's not an issue with the code.

This is how I've setup the SDK. My understanding is the region is ignored, so it doesn't matter.

new DocumentClient({
    region: 'local',
    endpoint: 'http://localhost:8000',
    sslEnabled: false,
})

Node just gives me:

UnknownError: Method Not Allowed
    at Request.extractError (/.../node_modules/aws-sdk/lib/protocol/json.js:51:27)
    at Request.callListeners (/.../node_modules/aws-sdk/lib/sequential_executor.js:106:20)
    at Request.emit (/.../node_modules/aws-sdk/lib/sequential_executor.js:78:10)
    at Request.emit (/.../node_modules/aws-sdk/lib/request.js:683:14)
    at Request.transition (/.../node_modules/aws-sdk/lib/request.js:22:10)
    at AcceptorStateMachine.runTo (/.../node_modules/aws-sdk/lib/state_machine.js:14:12)
    at /.../node_modules/aws-sdk/lib/state_machine.js:26:10
    at Request.<anonymous> (/.../node_modules/aws-sdk/lib/request.js:38:9)
    at Request.<anonymous> (/.../node_modules/aws-sdk/lib/request.js:685:12)
    at Request.callListeners (/.../node_modules/aws-sdk/lib/sequential_executor.js:116:18)

I'm running DynamoDB Local on macOS 10.14.6 with Java:

java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)

But I also tried with Amazon's Docker image and still the same error.

2 Answers 2

3

The port was in use by another application. And Java didn't bother to mention it when starting the DynamoDB Local server...

But that doesn't explain why the AWS CLI was working. Now I'm confused...

Sign up to request clarification or add additional context in comments.

1 Comment

I just saw the same thing happen, when I forgot I still had a listener on :8000 from a different project running. This error message is not very obviously worded. Re: the AWS CLI "working", I suspect it was not actually talking to the local dynamodb instance. This error means that dynamodb local is literally unable to get access to listen to port 8000 for incoming connections - there's no way it could work at all in this state, regardless of the client.
0

put any valid region like "us-east-1" instead of "local".

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.