Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
maher-rddi opened this issue Mar 8, 2023 · 30 comments
Open

Comments

@maher-rddi
Copy link

maher-rddi commented Mar 8, 2023

Hi, I am getting Error: "Error getting DynamoDb local latest tar.gz location: 403" after doing installing serverless-dynamodb-local.

Here is the full description of the error message:

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: darwin, node 16.17.0, framework 3.26.0 (local) 3.25.1v (global), plugin 6.2.2, SDK 4.3.2
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.
at Object.onceWrapper (node:events:628:26)
at ClientRequest.emit (node:events:513:28)
at ClientRequest.emit (node:domain:489:12)
at HTTPParser.parserOnIncomingClient [as onIncoming] (node:_http_client:674:27)
at HTTPParser.parserOnHeadersComplete (node:_http_common:128:17)
at Socket.socketOnData (node:_http_client:521:22)
at Socket.emit (node:events:513:28)
at Socket.emit (node:domain:489:12)
at addChunk (node:internal/streams/readable:315:12)
at readableAddChunk (node:internal/streams/readable:289:9)
at Socket.Readable.push (node:internal/streams/readable:228:10)
at TCP.onStreamRead (node:internal/stream_base_commons:190:23)

It seems that the bucket doesn't authorize my request!

@matAlmeida
Copy link

matAlmeida commented Mar 8, 2023

I'm getting the same error, apparently AWS changed the domain to https://s3.us-west-2.amazonaws.com/dynamodb-local/dynamodb_local_latest.tar.gz

Edit:
The fix was done in dynamodb-localhost project but not published yet

@maher-rddi
Copy link
Author

@matAlmeida Thanks, we will wait for the new release then.

@benjidotsh
Copy link

benjidotsh commented Mar 9, 2023

In the meantime, manually editing the download_url in node_modules/dynamodb-localhost/dynamodb/config.json to https://s3.us-west-2.amazonaws.com/dynamodb-local/dynamodb_local_latest.tar.gz and the import of http to https in node_modules/dynamodb-localhost/dynamodb/installer.js should do the trick!

@maher-rddi
Copy link
Author

@benjiJanssens it worked !! thanks a lot !

@cnuss
Copy link

cnuss commented Mar 13, 2023

@AshanFernando hey there! now that 99x/dynamodb-localhost#78 is merged, could we get a release to NPM which includes the fix?

@benjidotsh
Copy link

@cnuss you're in the wrong repo 😄 as soon as dynamodb-localhost gets a new release on npm, we can integrate the changes into serverless-dynamodb-local

@cnuss
Copy link

cnuss commented Mar 13, 2023

you're in the wrong repo

it appears 99x/serverless-dynamodb-local and 99x/dynamodb-localhost are maintained and released by the same individual(s) so I pinged here since this is the final(ish) destination 😄

@dev-cyprium
Copy link

In the meantime, manually editing the download_url in node_modules/dynamodb-localhost/dynamodb/config.json to https://s3.us-west-2.amazonaws.com/dynamodb-local/dynamodb_local_latest.tar.gz and the import of http to https in node_modules/dynamodb-localhost/dynamodb/installer.js should do the trick!

They should really make this configurable.

@kylevillegas93
Copy link

any update on this issue? it's blocking our CI.

@cidit
Copy link

cidit commented Mar 24, 2023

any update on this issue? it's blocking our CI.

youre not alone :')

@scottbasgaard
Copy link

Sad nothing happens :(

@alejandroch1202
Copy link

In the meantime, manually editing the download_url in node_modules/dynamodb-localhost/dynamodb/config.json to https://s3.us-west-2.amazonaws.com/dynamodb-local/dynamodb_local_latest.tar.gz and the import of http to https in node_modules/dynamodb-localhost/dynamodb/installer.js should do the trick!

It worked for me! Thanks!

@cnuss
Copy link

cnuss commented Mar 28, 2023

I've found a less-hacky way of getting the URL to update, and considering you're using NPM 8.3.0+ (also worked with yarn 1.22)

NOTE: I needed to clear my node_modules / build cache for this to work:

package.json:

  "devDependencies": {
      ...
      "serverless-dynamodb-local": "...",
      ...
  },
  "overrides": {
    "serverless-dynamodb-local": {
      "dynamodb-localhost": "https://github.com/99x/dynamodb-localhost#db30898f8c40932c7177be7b2f1a81360d12876d"
    }
  }

Ref: 99x/dynamodb-localhost#78
Ref: https://stackoverflow.com/questions/15806152/how-do-i-override-nested-npm-dependency-versions

@ovitor38
Copy link

I had the same issue when trying to run a project. What helped me was changing two files from the node_modules/dynamodb-localhost folder.

In node_modules\dynamodb-localhost\dynamodb\installer.js change http to https:

2023-03-30_17-47

node_modules\dynamodb-localhost\dynamodb\config.json change http to https
image
Maybe this will solve your problem

@RodPaDev
Copy link

Any ETA on when this is going to get published?

@jespinal
Copy link

To whom it may concern:

I faced this issue last week and CircleCI was really not liking it. I ended up adding the following in the scripts section of the packages.json file of the repo I was working with:

  "scripts": {
    "postinstall": "sed -i 's|http://s3-us-west-2|https://s3-us-west-2|g' ./node_modules/dynamodb-localhost/dynamodb/config.json && sed -i 's|require(\"http\")|require(\"https\")|g' ./node_modules/dynamodb-localhost/dynamodb/installer.js",
...
  },

Is it a bit hacky? yes, but I can get over it for now. I'm using sed to modify 2 files.

@BigsonLvrocha
Copy link

BigsonLvrocha commented Mar 31, 2023

@jespinal you could use patch-package for that

Edit: adding the link

@cnuss
Copy link

cnuss commented Apr 2, 2023

I've found a less-hacky way of getting the URL to update, and considering you're using NPM 8.3.0+ (also worked with yarn 1.22)

NOTE: I needed to clear my node_modules / build cache for this to work:

package.json:

  "devDependencies": {
      ...
      "serverless-dynamodb-local": "...",
      ...
  },
  "overrides": {
    "serverless-dynamodb-local": {
      "dynamodb-localhost": "https://github.com/99x/dynamodb-localhost#db30898f8c40932c7177be7b2f1a81360d12876d"
    }
  }

Ref: 99x/dynamodb-localhost#78 Ref: https://stackoverflow.com/questions/15806152/how-do-i-override-nested-npm-dependency-versions

I missed a line in my original comment, it also needs to be set in devDependencies for full integration

  "devDependencies": {
      ...
      "dynamodb-localhost": "https://github.com/99x/dynamodb-localhost#db30898f8c40932c7177be7b2f1a81360d12876d"
      ...
      "serverless-dynamodb-local": "...",
      ...
  },
  "overrides": {
    "serverless-dynamodb-local": {
      "dynamodb-localhost": "https://github.com/99x/dynamodb-localhost#db30898f8c40932c7177be7b2f1a81360d12876d"
    }
  }

Also found some issues with ourdering so make sure dynamodb-localhost is before serverless-dynamodb-local in devDependencies.

@Douglasblnk
Copy link

I have a doubt, why using pnpm the folder dynamodb-localhost is not created? I can't do the trick to change download_url with pnpm.

@aaaronme
Copy link

aaaronme commented Apr 10, 2023

I fixed it by simply copying over the .dynamodb folder into the root from another project where I had already run sls dynamodb install before

@colesiegel
Copy link

I have a doubt, why using pnpm the folder dynamodb-localhost is not created? I can't do the trick to change download_url with pnpm.

Doesn't work for me either

@ehtesham-turn
Copy link

Do we have fix this as of now ?

@bitsofinfo
Copy link

man, this long and no fix? this is annoying

@ehtesham1996
Copy link

man, this long and no fix? this is annoying

Last publish of the library was 2 years. Should we consider it as dead ?

@RodPaDev
Copy link

RodPaDev commented May 9, 2023

@ehtesham1996 Seems like it. I guess a fork would be a viable option

@HannahNguyen6729
Copy link

HannahNguyen6729 commented May 31, 2023

In the meantime, manually editing the download_url in node_modules/dynamodb-localhost/dynamodb/config.json to https://s3.us-west-2.amazonaws.com/dynamodb-local/dynamodb_local_latest.tar.gz and the import of http to https in node_modules/dynamodb-localhost/dynamodb/installer.js should do the trick!

thank you so much:
I fix it

@one-tonne-mee
Copy link

This issue appears to have been fixed in the latest release without need for any manual editing or switching the config json values

@juheba
Copy link

juheba commented Jun 17, 2023

This issue appears to have been fixed in the latest release without need for any manual editing or switching the config json values
On wich dependency is this fixe released?

The newest version via npm is serverless-dynamodb-local 0.2.40 and uses dynamodb-localhost 0.0.9 still with the old url.

As matAlmeida commented on Mar 8: PR 99x/dynamodb-localhost#78 merged but is not released yet.

In the comments are some suggestions provided on how to fix the issue:

  • benjidotsh commented on Mar 9 --> manually modify two files in node_modules/dynamodb-localhost and replace http to https
  • cnuss commented on Apr 2 --> add dynamodb-localhost from github containing the fix to dev dependencies
  • jespinal commented on Mar 31 --> add a postinstall script to package.json with sed commands to modify two files in node_modules/dynamodb-localhost and replace http to https

I used the command from jespinal:

sed -i 's|http://s3-us-west-2|https://s3-us-west-2|g' ./node_modules/dynamodb-localhost/dynamodb/config.json && sed -i 's|require(\"http\")|require(\"https\")|g' ./node_modules/dynamodb-localhost/dynamodb/installer.js

@domdomegg
Copy link

FYI: This package (serverless-dynamodb-local) doesn't appear to be maintained, with no new releases to NPM in over 2 years. Despite our pleas, I don't think this is getting deployed anytime soon. Over time, I think solutions that require creative uses of patch-package or sed will become fragile, and are a pain to maintain on each repo.

Solution: You can use serverless-dynamodb, a maintained fork, instead. (Disclaimer: I am a contributor to this fork). It is a drop-in replacement for this package, and is updated to fix this bug. This is a drop-in replacement for serverless-dynamodb-local, so to upgrade simply:

  1. Uninstall serverless-dynamodb-local, e.g. npm uninstall serverless-dynamodb-local
  2. Install serverless-dynamodb, e.g. npm install serverless-dynamodb
  3. Update references in your code, including your serverless config, from serverless-dynamodb-local to serverless-dynamodb (quite possible that you won't have any, as you just refer to it from your serverless config)
  4. (optional) Update your serverless config custom dynamodb key to serverless-dynamodb

Of course, it's all still open-source and MIT licensed. Ownership of this new package sits with a registered charity, that is committed to maintaining the package into the future and is open to contributions from the community.

There's an explanation as to the intentions behind this fork, and how it compares to other forks in the README.

In any case would be open to feedback on the fork - can drop create an issue in that repository or email me (address on profile).

@SweetRiot
Copy link

Thank youu!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests