Git Product home page Git Product logo

aws-param-store's People

Contributors

aaronfay avatar avnercohen avatar richardhyatt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

aws-param-store's Issues

npm install --production on consuming app missing aws-sdk

GIVEN that parent applicaiton has aws-param-store in their production dependencies
WHEN running npm install --production
THEN package requires aws-sdk
AND actually it is not present.

proposed solution: have aws-sdk as a dependency.

Timeout

Hi, I use the sample code and get a timeout after 3 seconds.

exports.handler = (event, context, callback) => {
	console.log("running");
	let awsParamStore = require( 'aws-param-store' );

	try {
		let parameters = awsParamStore.getParametersSync( ['/folder/var'], { region: 'us-east-1' } );
		console.log( parameters );
	}
	catch( err ) {
		console.log( err );
	}

}

I don't think it's a permissions or AWS config issue as the exact same lambda if I run this code it works:

var AWS = require('aws-sdk');
var ssm = new AWS.SSM();

exports.handler = function(event, context) {    
	getParameterFromSystemManager(function(){
		console.log('done');
	context.done(null, 'Hello from Lambda');
	});

};

function getParameterFromSystemManager(callback) {

	// Fetches a parameter called REPO_NAME from SSM parameter store.
	// Requires a policy for SSM:GetParameter on the parameter being read.
	var params = {
		Name: '/folder/var',
		/* required */
		WithDecryption: /*true ||*/ false
	};
	console.log('in the getParameterFromSystemManager function')
	var request = ssm.getParameter(params, function(err, data) {
		if (err) console.log(err, err.stack); // an error occurred
		else console.log(data); // successful response
	
		callback();
	});

}

add typings

add typings either in definitely typed or this project

Types or docs are wrong for getParametersByPath

I was attempting to call getParametersByPath in a TypeScript project and it told me path needed to be an array. The docs indicate that it's a string though. I'm not sure if the types are wrong or the docs. I added a @ts-ignore comment to that line and passed a string and it seemed to work.

Query parameter by name

Hi,

This is a feature request to add querying parameters by name instead of by path.

I looked at the code and played around with different calls but couldn't achieve the same functionality as aws ssm get-parameters --name 'my-parameter'.

I also played around with different libraries similar to this one and this is by far the best implementation I've tried, hence my decision to open an issue here.

Thanks,
Ronald

Synchronous version of getParameter methods don't work with same options as async

So I've been happily using the async versions of getParameter and getParametersByPath without issue like this:

const p = await ssm.getParameter(path, {
      credentials: new AWS.SharedIniFileCredentials({profile: environment})
});
console.log(p);

But when I use the sync version I get a "missing credentials in config" error.

const p = ssm.getParameterSync(path, {
      credentials: new AWS.SharedIniFileCredentials({profile: environment})
});
console.log(p)

I'm guessing it has to do with how SharedIniFileCredentials is resolved or surely this would have already been reported. Not sure how most people are passing their credentials to this library...

Doesn't work as expected

Have tried different combinations of recursive/decrypted/sync/async, nothing worked, no errors, empty response.

aws-param-store 1.1.0
aws-sdk 2.202.0
node v8.8.1

Ended up using native aws sdk.

const AWS_SSM = require('aws-sdk/clients/ssm')

var ssm = new AWS_SSM({region: 'ca-central-1'})

ssm.getParameters({
  Names: [
    '/test',
  ]
}, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
})

The security token included in the request is invalid

Error: The security token included in the request is invalid
at ParameterQuery.executeSync (platform-automation-tests/node_modules/aws-param-store/lib/param_query.js:139:19)
at Object.getParameterSync (platform-automation-tests/node_modules/aws-param-store/lib/index.js:54:10)
at Object. (platform-automation-tests/src/test/utils/AwsParamStore.js:7:36)
at Module._compile (node:internal/modules/cjs/loader:1092:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1121:10)
at Module.load (node:internal/modules/cjs/loader:972:32)
at Function.Module._load (node:internal/modules/cjs/loader:813:14)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)
at node:internal/main/run_main_module:17:47

I'm getting the above error when I run awsParamStore.getParameterSync(). Is there some configuration that is required?

Unable to use with create-react-app

It looks like index.js is not pre-compiled to ES5. I receive this error when I try to use it in an app using create-react-app:

Creating an optimized production build...
Failed to compile.

Failed to minify the code from this file:

        ./node_modules/aws-param-store/lib/index.js:5

Read more here: http://bit.ly/2tRViJ9

I'd provide a solution, but am unsure exactly what that would be because I'm relatively new to create-react-app and the relationship between this project and ES5/ES6.

Adding region to README

It might be worth adding comment into readme that it needs AWS_REGION
e.g.
export AWS_REGION=eu-west-1

getParameterSync results in Runtime.UserCodeSyntaxError: SyntaxError: Unexpected end of JSON input

This happens on AWS lambda Node 14.x. Running the same code on our ECS service did not result in this error. Not sure exactly what is causing it, but switching to the async call getParameter fixed the error for us, so seems like there is a bug in the sync version of getParameter.

Here's the full stack trace, but it's not very helpful:

{
    "errorType": "Runtime.UserCodeSyntaxError",
    "errorMessage": "SyntaxError: Unexpected end of JSON input",
    "stack": [
        "Runtime.UserCodeSyntaxError: SyntaxError: Unexpected end of JSON input",
        "    at _loadUserApp (/var/runtime/UserFunction.js:98:13)",
        "    at Object.module.exports.load (/var/runtime/UserFunction.js:140:17)",
        "    at Object.<anonymous> (/var/runtime/index.js:43:30)",
        "    at Module._compile (internal/modules/cjs/loader.js:1063:30)",
        "    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)",
        "    at Module.load (internal/modules/cjs/loader.js:928:32)",
        "    at Function.Module._load (internal/modules/cjs/loader.js:769:14)",
        "    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)",
        "    at internal/main/run_main_module.js:17:47"
    ]
}

Merge fork

Hiya,

It seems like things are inactive here, so I have forked and added ask-sdkv3 support at https://github.com/coggle/aws-param-store (published as aws-param-store-sdkv3), adding an explicit dependency on @aws-sdk/client-ssm but if you are interested in merging this please do.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.