serverless-dynamodb-local icon indicating copy to clipboard operation
serverless-dynamodb-local copied to clipboard

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

Open maher-rddi opened this issue 2 years ago • 30 comments
trafficstars

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!

maher-rddi avatar Mar 08 '23 11:03 maher-rddi

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

matAlmeida avatar Mar 08 '23 13:03 matAlmeida

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

maher-rddi avatar Mar 08 '23 14:03 maher-rddi

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!

benjidotsh avatar Mar 09 '23 17:03 benjidotsh

@benjiJanssens it worked !! thanks a lot !

maher-rddi avatar Mar 09 '23 18:03 maher-rddi

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

cnuss avatar Mar 13 '23 15:03 cnuss

@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

benjidotsh avatar Mar 13 '23 16:03 benjidotsh

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 😄

cnuss avatar Mar 13 '23 16:03 cnuss

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.

dev-cyprium avatar Mar 14 '23 13:03 dev-cyprium

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

kylevillegas93 avatar Mar 22 '23 22:03 kylevillegas93

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

youre not alone :')

cidit avatar Mar 24 '23 16:03 cidit

Sad nothing happens :(

scottbasgaard avatar Mar 27 '23 09:03 scottbasgaard

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!

alejandroch1202 avatar Mar 28 '23 01:03 alejandroch1202

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: https://github.com/99x/dynamodb-localhost/pull/78 Ref: https://stackoverflow.com/questions/15806152/how-do-i-override-nested-npm-dependency-versions

cnuss avatar Mar 28 '23 13:03 cnuss

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

ovitor38 avatar Mar 30 '23 20:03 ovitor38

Any ETA on when this is going to get published?

RodPaDev avatar Mar 31 '23 09:03 RodPaDev

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.

jespinal avatar Mar 31 '23 14:03 jespinal

@jespinal you could use patch-package for that

Edit: adding the link

BigsonLvrocha avatar Mar 31 '23 16:03 BigsonLvrocha

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.

cnuss avatar Apr 02 '23 16:04 cnuss

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.

Douglasblnk avatar Apr 04 '23 04:04 Douglasblnk

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

aaaronme avatar Apr 10 '23 05:04 aaaronme

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

colesiegel avatar Apr 24 '23 16:04 colesiegel

Do we have fix this as of now ?

ehtesham-turn avatar May 08 '23 18:05 ehtesham-turn

man, this long and no fix? this is annoying

bitsofinfo avatar May 08 '23 20:05 bitsofinfo

man, this long and no fix? this is annoying

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

ehtesham1996 avatar May 09 '23 12:05 ehtesham1996

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

RodPaDev avatar May 09 '23 13:05 RodPaDev

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

HannahNguyen6729 avatar May 31 '23 06:05 HannahNguyen6729

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

one-tonne-mee avatar Jun 15 '23 10:06 one-tonne-mee

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 https://github.com/99x/dynamodb-localhost/pull/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

juheba avatar Jun 17 '23 13:06 juheba

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

domdomegg avatar Jul 04 '23 00:07 domdomegg

Thank youu!

SweetRiot avatar Nov 23 '23 00:11 SweetRiot