99x/dynamodb-localhost

Receiving 403 response when downloading dynamodb_local_latest.tar.gz from s3 bucket

katesclau opened this issue ยท 10 comments

Hey ๐Ÿ‘‹

My first contribution here - seems to be a regression of #37

latest tar.gz was updated yesterday

<ContentsContents>
  <Key>dynamodb_local_latest.tar.gz</Key>
  <LastModified>2023-02-02T18:02:28.000Z</LastModified>
  <ETag>"265a5d3d71889672d30e2bce91e83387-6"</ETag>
  <Size>42739735</Size>
  <StorageClass>STANDARD</StorageClass>
</Contents>

But starting dynamodb fails with

Started downloading dynamodb-local from http://s3-us-west-2.amazonaws.com/dynamodb-local/dynamodb_local_latest.tar.gz into .../.dynamodb. Process may take few minutes.
โœ– Uncaught exception
Environment: linux, node 14.17.0, framework 3.24.1 (local), plugin 6.2.2, SDK 4.3.2
Credentials: Local, "..." profile
Docs:        docs.serverless.com
Support:     forum.serverless.com
Bugs:        github.com/serverless/serverless/issues

Error:
Error: Error getting DynamoDb local latest tar.gz location undefined: 403
    at ClientRequest.<anonymous> (/.../node_modules/dynamodb-localhost/dynamodb/installer.js:29:15)

Unsure who owns the s3 bucket, but it is not reachable programmatically, but reachable through browser download https://s3-us-west-2.amazonaws.com/dynamodb-local/dynamodb_local_latest.tar.gz

Checking if we are missing any headers

This appears to be an issue where the file is not accessible via HTTP, but is available via HTTPS. This is causing issues in downstream packages as well such as serverless-dynamodb-local.

Looks like the URL is hard coded here as of now. https://github.com/99x/dynamodb-localhost/blob/63eb919715496950a64272eb62f36e18fa12737a/dynamodb/config.json#LL3C10-L3C10

That's our case - what we did to mitigate the issue is to upload to our s3 bucket and update the config.json

#78 (review) fixes this issue

For now, I created a work around.

Instead of call serverless dynamodb install you can use following script:

curl <download URL> --output dynamodb.tar.gz
mkdir ./.dynamodb
tar -zxf dynamodb.tar.gz --directory ./.dynamodb

You can find the download URL for your region here. (https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.DownloadingAndRunning.html)
Replace <download URL> in the snipped with your selected URL. Just make sure to select the .tar.gz link.

Fixed in #78 ๐ŸŽ‰

Why mark this as fixed? The PR is still open.

Also, when will this become available via NPM?

Ping @AshanFernando can we have a version bump to get this live please?

I am still getting this error:

Started downloading dynamodb-local from http://s3-us-west-2.amazonaws.com/dynamodb-local/dynamodb_local_latest.tar.gz into /home/user/Desktop/tractatus/api-management-service/.dynamodb. Process may take few minutes.
โœ– Uncaught exception
Environment: linux, node 20.2.0, framework 3.32.2 (local) 3.32.2v (global), plugin 6.2.3, SDK 4.3.2
Docs:        docs.serverless.com
Support:     forum.serverless.com
Bugs:        github.com/serverless/serverless/issues

My package.json:

"devDependencies": {
    "serverless-dynamodb-local": "^0.2.40",
    "serverless-python-requirements": "^6.0.0",
    "serverless-wsgi": "^3.0.1"
  }

I'm still getting this error:

Started downloading dynamodb-local from http://s3-us-west-2.amazonaws.com/dynamodb-local/dynamodb_local_latest.tar.gz into C:\Sites\GoThrive\gothrive.web\gothrive-serverless-http-api.dynamodb. Process may take few minutes.
ร— Uncaught exception
Environment: win32, node 18.16.0, framework 3.35.2, plugin 7.0.5, SDK 4.4.0
Credentials: Serverless Framework Provider: "default" (https://app.serverless.com/gothrive/apps/gothrive-serverless-http-api/gothrive-serverless-http-api/dev/us-east-1/providers)
Docs: docs.serverless.com
Support: forum.serverless.com
Bugs: github.com/serverless/serverless/issues

Error:
Error: Error getting DynamoDb local latest tar.gz location undefined: 403