Google Cloud Storage - "Error: Could not load the default credentials" - javascript

While developing my app in Node.js, I decided to persist my data by using the Google Cloud Storage client libraries.
I came across the error mentioned in the title when uploading to storage:
Error: Could not load the default credentials
I did some digging, and figured out how to solve the issue:
Navigating to google cloud console credentials and creating a service account.
Setting the role for the service account to have full object permissions across my project and my buckets
Creating a key for the service account and downloading the associated .json file
Installing Cloud SDK and running the commands:
gcloud auth application-default login
gcloud config set project [MY_PROJECT_ID]
gcloud auth activate-service-account --key-file=C:/path/to/json/file
In my code passing in the .json credentials file into my new client instance:
const storage = new Storage({keyFileName: "auth.json"})
These steps described fixed the issue... in development. When I deployed my app to production the same error message comes back
I tried a few things to solve the issue. I assumed it was an issue with my web host: A2. After talking with their tech support they reassured me my file paths are correct inside their file structure, but they would not help me troubleshoot the credentials error otherwise.
So, why would my credentials be working just fine in development, but then suddenly stop working in production? Is it because I had the localhost as the callback URI instead of the domain name (or something)? Do I need to specify the domain somewhere in SDK or in the cloud console?
The error message points me to https://cloud.google.com/docs/authentication/getting-started, but I have read and reread the documentation many times, so if someone can point me to the specific place in the docs that says what I need to do that would be appreciated, but be aware that I have done my homework and I RTFM, but I am still unable to solve this issue.

Related

getting javax.mail.AuthenticationFailedException on heroku

I am Using Heroku to deploy my java spring boot backend which utilizes the javamailsender. When testing locally before deployment, I was able to send emails and receive emails thru the application. But, ever since I deployed it on heroku, I have been receiving error whenever I try to send email.
Error Sending Email: Authentication failed; nested exception is javax.mail.AuthenticationFailedException: 534-5.7.9 Application-specific password required. Learn more at
2020-07-17T01:00:29.110458+00:00 app[web.1]: 534 5.7.9 https://support.google.com/mail/?p=InvalidSecondFactor r188sm8440648qkf.128 - gsmtp
2020-07-17T01:00:29.110462+00:00 app[web.1]:
I have seen plenty of articles/discussion forum where users encounter such problem and I tried to resolve using the solution that was given but was unsuccessful. I have the 2-Step-Verification on and turned on the less secure app but no luck. I also saw that doing App Password helped solved the issue but didn't really understand how to go about that in terms of my app on heroku. I have react frontend hosted on firebase and spring boot backend hosted on heroku. Any help would be appreciated. Thank you!
Nvm, I figured out what was causing this error. I guess I had to create an App Password and use that password that was created inside my application.properties.

Heroku Logs Not Loading

In my Heroku dashboard or on my command, when I try to open my logs i get a 503 Service Unavailable and I can't file a support ticket because I am using a free account. Does anyone know why this would be happening? The Heroku status monitor also says that Heroku services are all good https://status.heroku.com/. My app is also currently running and it does not seem to be affected. I am pretty sure this is an issue with Heroku but I can't get any support due to being a free account.

Netlify "user is not authorized to perform: dynamodb:PutItem on resource"

I'm trying to get a hand with Netlify and AWS. I have downloaded a sample REST API preset from the official serverless site here.
The site worked locally after serverless deploy including the create route, used to add new todo elements into the db (API gateway on Amazon shows no issues)
I wanted to test how would it work on netlify, so I created a bitbucket repo from the file and uploaded it into the netlify servers.
From the start, there were minor issues. Such as an error claiming that TableName which in code is created from process.env.DYNAMODB_TABLE was not provided.
After replacing the value with the value of the field, I got an error saying that
{User: arxxxx:assumed-role/aws-lambda-execute/xxx is not authorized to perform: dynamodb:PutItem on resource: arn:aws:dynamodb:us-xxx-1:xxx:table/serverless-rest-api-with-dynamodb-dev","code":"AccessDeniedException","time":"xxx","requestId":"xxx","statusCode":400,"retryable":false,"retryDelay":30.76949318814495}
The issue suggests that my serverless parameters are wrong, however I do have the permissions set:
provider:
name: aws
runtime: nodejs6.10
environment:
DYNAMODB_TABLE: ${self:service}-${opt:stage, self:provider.stage}
iamRoleStatements:
- Effect: Allow
Action:
- dynamodb:Query
- dynamodb:Scan
- dynamodb:GetItem
- dynamodb:PutItem
- dynamodb:UpdateItem
- dynamodb:DeleteItem
Resource: "arn:aws:dynamodb:${opt:region, self:provider.region}:*:table/${self:provider.environment.DYNAMODB_TABLE}"
And all seem to work fine when the data is local.
Has anyone ever had such issue?

Cloud foundry nodejs sample app not working

I'm just beginning to use cloud foundry.
I ran this node js sample app of cloud foundry on predix (I just changed the app name in manifest.yml). The code is fine locally and can be pushed to the cloud using cf CLI. The app status in the console is started for both of them. But when I go to the URL, the site can't be reached. Please help.
Edit
The microservice template is not running locally.
In the cloud, make sure you're using the https:// protocol. This is required in Predix cloud.
Locally, what errors do you see?

How do I add information to my Heroku database?

I am currently trying to deploy a Node.js application to Heroku. The website is working until I try and login or do other operations that call the database. I have the database attached and keep getting the Error: write EPIPE error. From what I can tell from my research, it seems like I need a worker process. Right now I have my web process as ./bin/www and I do not know what to set my worker process to. I tried setting it to the same thing, but the app crashes. How do I add information from my app to a Heroku database?

Categories

Resources