Heroku Website - Where is the REDIS HOST credential? - heroku

I am trying to set the REDIS_HOST in Settings -> Config Vars on the Heroku website.
I have added a "Heroku Redis::Redis" add-on. When I go in to it, I am expecting to see a screen like this;
But instead all I get is this;
There is nothing on this page relating to a HOST name of any description. There are barely any links and certainly not to a settings page.
Am I missing something obvious? I am a total Heroku newbie and Google is giving me nothing!
Or have Heroku just changed their UI for a laugh?

I have managed to solve this. I'm submitting this answer because I really do not think it's obvious for a beginner.
When a REDIS add-on has finished building, Heroku will automatically generate a REDIS_URL key/value pair for you (might take a few minutes). It will look something like this;
REDIS_URL = redis://h:p8jnn2hm2a01fm65ssfdkj2#ec2-41-117-183-81.eu-west-1.compute.amazonaws.com:11509
With this, you can manually create the following config variables using parts of the REDIS_URL value above. For example;
REDIS_PASSWORD = p8jnn2hm2a01fm65ssfdkj2
REDIS_HOST = ec2-41-117-183-81.eu-west-1.compute.amazonaws.com
REDIS_PORT = 11509
For me, that was all I needed to get my site working. I don't understand why they decided to do it this way.

Related

Heroku : Edit file without edit on github

I have a discord bot on heroku and I am using automatic deployment with github. I have a .json data file and I am trying to write data to it, but it doesn't seem to work. I guess this takes my data file straight from github and therefore remains empty. On my computer, it works well, I manage to write in my db.json but on heroku it does not work, I have no errors. I am using a relative path and not abosulu so I don't think the error is with my code. I don't know if I was clear
Thank you in advance

Heroku not applying environment variable changes in Okta OAuth 2.0 PKCE VueJs app

I' trying to execute the OAuth 2.0 PKCE demo with a VueJs app outlined here:
https://developer.okta.com/blog/2019/08/22/okta-authjs-pkce
https://github.com/oktadeveloper/okta-auth-js-pkce-example
Once in the Heroku App I have these Environment Variables:
Everything appears to be running fine except for the fact that the variables OKTA_CLIENT_ORGURL and OKTA_OAUTH2_ISSUER were refering to an incorrect dev-XXXXXX address, the correct one is the one shown on the picture (dev-371167), before it was someone else's url (dev-739491) for some reason.
The problem is that after making the changes shown in the image to the correct dev url, it's still making the calls to the old dev-739491 url.
Heroku doesn't seem to be refreshing or making the desired changes in the app.
Am I missing an option to refresh? Is it possible to rebuild so it reads the new changes? Could the problem be in the code/build itself?
Thanks.
EDIT: As per the suggestion in the comment I turned the app off then on again and it still didn't make the changes.
This is what my screen looks like:
EDIT 2: I have since deployed the same app two more times and reading the build logs it assigns a random CLIENT_ID and URls. Each deployed app has a different pair of these. I don't know where they come from.
I wrote the Okta Heroku Add-On. I'm looking into the behavior you're seeing.
When you change the environment variables, heroku should restart your app automatically.
So, the two issues are that the environment variables didn't match you saw in Heroku didn't match with what you expected them to be and that the app doesn't seem to be picking up on the environment variables.
How did you know that dev-371167 was the correct org and that dev-739491 was incorrect?
When you say you deployed the app two more times, what exactly are you doing to deploy? Are you using the Heroku cli?

Replace localhost with my domain in Laravel when in production

I am using SPA (Laravel and Vuejs). When in development, website project worked perfect but when after running npm run production and put it on live server, I got errors saying
Access to Xmlhttprequest at http://localhost:8000/auth_check from origin https://hamariweb.com/auth_check has been blocked by Cors policy.
I have tried different solutions that fixed their problems but not mine. I want to know what is wrong with it and how can I fix it?
Sounds like somewhere in your code you're trying to send a request to http://localhost:8000/auth_check which isn't going to work in prod. You need to find the call to that URL and replace it with a call to the correct URL.
You can create an ENV setting in your .env file like this.
APP_URL=https://hamariweb.com
Then share that env file to your javascript code like this.
MIX_APP_URL="${APP_URL}"
Any ENV settings that start with MIX_ are passed to Javascript and this is passing it the initial APP URL value.
To finally grab the app url in the JS do this:
process.env.MIX_APP_URL
You can even assign the entire env settings globally like this.
if(process && process.env){
window.env = process.env;
}
Any .env MIX_ variables will be available in window.env at that point and in your SPA you'll be able to make the URL or any other variable configurable based on environment.

Heroku No such app for Dropbox based app

I had a app hosted on 'inputbox.herokuapp.com'.
My app was giving error even after successful deployment. So, I deleted the app and recreated the same app.
But now I am getting error message as:
"Heroku | No such app
There is no app configured at that hostname.
Perhaps the app owner has renamed it, or you mistyped the URL."
I looked around for heroku docs but nothing works.
I dont know how to get this fixed. Please help.
Check what apps you currenty have using
heroku apps
It should say something like
=== My Apps
inputbox
If it doesn't, then you know what the problem is. Let's say it has one of those silly generated names, then you can rename it using the following command:
heroku apps:rename inputbox
Happy hacking!

Facebook Sinatra app won't login

I am trying to develop a Facebook Application using the Ruby Heroku pack provided. I have experimented with this before but just created a new app to develop. I am having an issue where I am unable to log in with the app. I click on a button to log in, but after the redirects, I find that nothing has happened. Once in every 20 or so attempts though, it will log me in correctly.
For those who've never used the Heroku hosting for Facebook, here is the template that gets installed. The only changes I have made were to modularize the app.
The relevant routing is as follows:
get "/auth/facebook" do
session[:access_token] = nil
redirect authenticator.url_for_oauth_code(:permissions => FACEBOOK_SCOPE)
end
get '/auth/facebook/callback' do
session[:access_token] = authenticator.get_access_token(params[:code])
redirect '/'
end
Has anyone ever experienced this before? If one would like to try themselves, this is the location of the app. I have a similar one running that doesn't exhibit this problem, so I really can't figure it out.
EDIT: I think I found the problem. I had set Unicorn preload_app to false, following this piece of information from New Relic. Setting preload_app to true has since fixed the problem. Unfortunately, I cannot remember why I set it to false in the first place (I have adapted some configuration stuff from a previous app). Maybe someone has better knowledge than myself.

Resources