ryanmurakami / pizza-luvrs

❤️🍕🍕❤️ Demo project for AWS Developer: Getting Started on Pluralsight
114 stars 255 forks source link

DeprecationWarning: crypto.pbkdf2 without specifying a digest is deprecated #13

Closed shayaneumar closed 4 years ago

shayaneumar commented 6 years ago

I am getting this error while creating a new pizza from the application runing locally on my machine. My machine is running under properly credentials as I am able to run aws cli without any problem. I have moved the static content to S3 and also configure my EC2 instance to have full S3 access as you have specified in the demo.

I have installed on node v6.2.2 my machine

(node:5612) DeprecationWarning: crypto.pbkdf2 without specifying a digest is deprecated. Please specify a digest Debug: internal, implementation, error InvalidRequest: The authorization mechanism you have provided is not supported. Please use AWS4-HMAC-SHA256. at Request.extractError (C:\Manhattan\Learning\aws\pizza-luvrs\node_modules\aws-sdk\lib\services\s3.js:350:35) at Request.callListeners (C:\Manhattan\Learning\aws\pizza-luvrs\node_modules\aws-sdk\lib\sequential_executor.js:105:20) at Request.emit (C:\Manhattan\Learning\aws\pizza-luvrs\node_modules\aws-sdk\lib\sequential_executor.js:77:10) at Request.emit (C:\Manhattan\Learning\aws\pizza-luvrs\node_modules\aws-sdk\lib\request.js:615:14) at Request.transition (C:\Manhattan\Learning\aws\pizza-luvrs\node_modules\aws-sdk\lib\request.js:22:10) at AcceptorStateMachine.runTo (C:\Manhattan\Learning\aws\pizza-luvrs\node_modules\aws-sdk\lib\state_machine.js:14:12) at C:\Manhattan\Learning\aws\pizza-luvrs\node_modules\aws-sdk\lib\state_machine.js:26:10 at Request. (C:\Manhattan\Learning\aws\pizza-luvrs\node_modules\aws-sdk\lib\request.js:38:9) at Request. (C:\Manhattan\Learning\aws\pizza-luvrs\node_modules\aws-sdk\lib\request.js:617:12) at Request.callListeners (C:\Manhattan\Learning\aws\pizza-luvrs\node_modules\aws-sdk\lib\sequential_executor.js:115:18)

tomschinelli commented 6 years ago

run npm install -S aws-sdk@2.211.0 (current latest version at the time I write this)

then update the /lib/imageStoreS3.js file :

const AWS = require('aws-sdk');
module.exports.save = (name, data, callback) => {

    let buf = new  Buffer(data, 'base64');
    let s3Bucket = new AWS.S3( { params: {Bucket: '__BUCKET_NAME__'} } );
    let params = {
        Key: `pizzas/${name}.png`,
        Body: buf,
        ContentEncoding: 'base64',
        ContentType: 'image/jpeg'
    };
    s3Bucket.putObject(params, function(err, data){
            callback(err, `https://s3.__YOUR_REGION__.amazonaws.com/__BUCKET_NAME__/${params.Key}`)
    });

};

this worked for me