Skip to content

Commit 1c4582b

Browse files
committed
change Readme file
1 parent 344182a commit 1c4582b

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

README.md

+24
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,27 @@ And I will get back a 200 OK response of the below form-data
6767
```
6868

6969
[Small note on .env file - When putting the value for "AWS_Uploaded_File_URL_LINK" - I have to include a forward slash ("/") after ]
70+
71+
## Huge Issue I faced after changing the AWS credentials - The upload was failing and in Postman was giving error sourse something like "The AWS Key is not a valid one"
72+
73+
The app was taking old `process.env` variable rather than what I set inside the app in the .enf file - 29-Nov-2018
74+
75+
The backend Route for document upload will not take what I was setting up in the .env file rathar was taking from a catch.
76+
77+
So in the backend upload routes .js file I put the below to see what it was throwing.
78+
79+
console.log(process.env.AWS_BUCKET_NAME);
80+
console.log(process.env.AWS_ACCESS_KEY_ID);
81+
console.log(process.env.AWS_SECRET_ACCESS_KEY);
82+
console.log(process.env.AWS_REGION);
83+
console.log(process.env.AWS_Uploaded_File_URL_LINK);
84+
85+
And saw it was taking a completely wrong AWS credentials.
86+
87+
Then I ran the command `unset AWS_ACCESS_KEY_ID`, which was deleting the key and after doing this unset, then running
88+
89+
`echo $AWS_ACCESS_KEY_ID`
90+
91+
was no more showing the value in the terminal, but as soon as I send a POST request to upload a document with Postman, again, I will get back that wrong key in the Terminal
92+
93+
### Final Solution - Plain old whole full system (my local machine) restart.

routes/fileUploadRoutes.js

+3
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ router.post("/upload", upload.single("file"), function(req, res) {
5050
region: process.env.AWS_REGION
5151
});
5252

53+
console.log(process.env.AWS_ACCESS_KEY_ID);
54+
console.log(process.env.AWS_SECRET_ACCESS_KEY);
55+
5356
//Where you want to store your file
5457

5558
var params = {

0 commit comments

Comments
 (0)