Ad

DynamoDB Local Throws Method Not Allowed Via SDK

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.

Ad

Answer

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...

Ad
source: stackoverflow.com
Ad