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

fix: update installer to use https for download #78

Merged
merged 1 commit into from
Mar 7, 2023
Merged

fix: update installer to use https for download #78

merged 1 commit into from
Mar 7, 2023

Conversation

eheyder
Copy link
Contributor

@eheyder eheyder commented Mar 3, 2023

Copy link

@sethalt sethalt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Copy link

@jnorris-rbi jnorris-rbi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for tackling this change!

Copy link

@pablogdnd pablogdnd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link

@jphechter jphechter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add this.

@pablogdnd
Copy link

@AshanFernando can you check at this?

@DeeWBee
Copy link

DeeWBee commented Mar 3, 2023

@AshanFernando several projects are now falling apart. Please fix this.

Copy link

@yaguchii yaguchii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merge please

@kairi4
Copy link

kairi4 commented Mar 6, 2023

@rehrumesh @mjzone
Please review and merge this PR if possible

@@ -3,7 +3,7 @@
var tar = require("tar"),
zlib = require("zlib"),
path = require("path"),
http = require("http"),
https = require("https"),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

    http = require('http'),
    https = require('https'),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keeps support for http as well as https

@@ -12,7 +12,7 @@ var download = function(downloadUrl, installPath, callback) {
console.log(
`Started downloading dynamodb-local from ${downloadUrl} into ${installPath}. Process may take few minutes.`
);
http
https

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

    const client = downloadUrl.toLowerCase().startsWith('https') ? https : http;
    client
        .get(downloadUrl, function (response) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vestel
Copy link

vestel commented Mar 6, 2023

Looks good! Please approve!

@LeoFalco
Copy link

LeoFalco commented Mar 6, 2023

merge please

Copy link

@willaug willaug left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merge, please?

@DeeWBee
Copy link

DeeWBee commented Mar 6, 2023

Circling back here: I ditched this package (along with severless-dynamodb-local) and resorted to using Docker + DynamoDB. I modified the docker-compose file to use my desired port but otherwise kept the default configuration in place (as provided by AWS).

From there, I manually created needed tables inside the Docker image. To create tables in the Docker image, you append --endpoint-url http://localhost:[YOUR_PORT_HERE] to the regular create table command. From there, I was able to start my app using sls offline start. It's clear the author of these packages won't be updating anytime soon. I suggest people implement similar solutions and move off this expired package.

I'll update this comment once the problematic packages have been completely removed from my app.

UPDATE: I removed the problematic packages from my app, and everything still works. I am officially done using these. Like I said, I suggest people do the same.

Copy link

@jlau-neonone jlau-neonone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fix worked for me.

Copy link

@jlau-neonone jlau-neonone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This worked for me.

@Viserion77
Copy link

Viserion77 commented Mar 6, 2023

I joined node_modules and edit directly the dynamodb-localhost files with the changes of this PR and it worked!

@DeeWBee
Copy link

DeeWBee commented Mar 6, 2023

For those of you directly editing node_modules - please understand the next time you run npm install or clear your cache (or any equivalent commands), you will overwrite your edits and it will be broken again. Please consider using different solutions.

@sachet-mittal
Copy link

@DeeWBee I think the solution you are suggesting is a very complicated workaround and adding a new infra (docker) in project which may not be possible for all the projects. The "correct" fix is to patch the node_modules using https://github.com/ds300/patch-package.

note: I say this is correct as this would work on local/docker/CI-CD environments with minimal changes but YMMV. If docker works for you then please continue doing that as you already tackled the most difficult part and made your project more robust.

@AshanFernando AshanFernando merged commit db30898 into 99x:master Mar 7, 2023
@gpmcadam
Copy link

gpmcadam commented Mar 7, 2023

thanks for merging. any idea when this will be published to npm?

@McKean
Copy link

McKean commented Mar 8, 2023

if anyone needs this to work in your containers (for testing) until the package is updated, just throw those lines into your Dockerfile after installing your packages (npm install or yarn)

# until package is updated
RUN sed -i 's|http://s3-us-west-2.amazonaws.com/dynamodb-local/dynamodb_local_latest.tar.gz|https://s3.us-west-2.amazonaws.com/dynamodb-local/dynamodb_local_latest.tar.gz|g' node_modules/dynamodb-localhost/dynamodb/config.json
RUN sed -i 's|http|https|g' node_modules/dynamodb-localhost/dynamodb/installer.js

@jonnixt17
Copy link

jonnixt17 commented Mar 9, 2023

Or npm install --save 99x/dynamodb-localhost#db30898f8c40932c7177be7b2f1a81360d12876d should work while we wait. (Do keep in mind there was at least one additional merge done between the last npm release and the current master.)

@LeoFalco
Copy link

Helllo, @AshanFernando

Can you publish this fix on npm too ?

@LeoFalco
Copy link

Helllo, @AshanFernando

Can you publish this fix on npm too ?

I wish a new released version to bump dependency of dynamodb-localhost lib on package serverless-dynamodb-local

@codebravotech
Copy link

Please merge!

@voccer
Copy link

voccer commented Apr 18, 2023

the PR was merged, but it is still an old version in the npm package.

@colesiegel
Copy link

colesiegel commented Apr 24, 2023

This still doesn't work - was it released?

@AshanFernando

@tspangler
Copy link

looks like this needs a new npm release

@domdomegg
Copy link

FYI: Despite this PR being merged, this fix to the package (dynamodb-localhost) still hasn't been published, with no new releases to NPM in over 4 years.

Solution: You can use aws-dynamodb-local, 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. If you're using serverless-dynamodb-local, you can also replace that with it's equivalent serverless-dynamodb.

Migrating takes about 2 minutes, with a full guide in the README. 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.

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

Successfully merging this pull request may close these issues.

None yet