Problems uploading an application to HEROKU, Failed with async. H12 - javascript

when trying to deploy my app in heroku, I get this error:
I'm trying to search the net but I can't find anything definitive. Just say that it works perfect for me at local. I use MAMP, the database is in myphpadmin and I think I imported it correctly in Heroku. The .env variables that I have are:
BD_NAME = agencydeviajes
BD_USER = root
BD_PASS = root
BD_HOST = 127.0.0.1
BD_PORT = 8889
HOST = localhost
My heroku variables:
And this is my repository: Git HUB Repository
I haven't been able to find a solution for more than a week and I'm a little desperate, I appreciate a lot of ideas. This is the error log.
I am new to Heroku and I am learning Java Script. Thank you very much to all

I don't think you can reference localhost on heroku. Try using postgres url instead, e.g: postgres://dbUserName:dbPassword#db.server:dbPortNumber/dbName.
its easier to manage. Heroku has a postgres service to. You could follow this link to learn more about the postgres addon on heroku

Related

Netlify throws 404 error with /graphql only when deployed

I have an app which I had pushed to heroku a few days ago, where it works fine, but when deploying the app to Netlify, the app deploys but the graphQL connection throws a 404 error. Here are some images.
Here is the code I use in App.js
Is there anyone that knows how I can fix this? Much appreciated
Netlify doesn't run a app server like Heroku, it only runs a static file server. From your code, it appears that you're trying to serve a app that you could connect to and provide yourself with GraphQL access. This is not possible on Netlify, at least not directly.
The only server-like solution that Netlify currently provides in Netlify Functions. However, those are limited to 10 sec by default and provide, one-time data connection - not something that you could keep on using for GraphQL.
So if your requirement is to keep the GraphQL server running (for example like what Gatsby does during gatsby develop), Netlify is not the solution for you. If you wish to send the data one-time and add some server-side processing, you can take a look at Netlify Functions.

Strapi deployment

I am new to Strapi and I found it really good, I got my website in development mode locally working perfectly fine but I can not get my head around or find any good guide how to host Strapi on Debian Linux server, that I have, to be part of website and to access Strapi control panel for example mywebiste.com/admin so I can add content as blog posts directly by logging in to website admin part. Is that possible or I must use some services like Heroku. if someone can provide in short step by step what to do I will really appreciate that. I tried already create new Strapi project inside public_html folder but its not working
I use strapi on my project . I hosted strapi on pm2 package. Its very easy.
this documention https://docs.strapi.io/developer-docs/latest/guides/process-manager.html#install-pm2
don't forget add startup Ubuntu to pm2. Otherwise when Ubuntu started then not starting pm2
I suggest use Ubuntu.
Nginx Configuration
In order to deploy it to a Linux server, you need to install nginx, and set it up. You can find instructions in official documentation: https://docs.strapi.io/developer-docs/latest/setup-deployment-guides/deployment/optional-software/nginx-proxy.html#nginx-virtual-host

Express-session cause heroku app to throw internal server error

App was totally working locally however after deployment via heroku it started to throw internal server error. Just one time app worked via heroku and then again it started to give internal server error. Then i tried to find the source of error and i found the express-session is crashing my app when it is deployed via heroku.
Edit: App doesn't crash in the middle of the process, it doesn't totally work. No path is working. Every path throws internal server error because of express-session.
Server Codes
Sorry i forgot that i still have this question. I solved the issue. Problem was the session secret. I didn't realize that my .env file is in gitignore file and session was not taking secret from .env so i added a heroku config, named SECRET and that's the solution.

How to serve a REST API on Heroku

I've built a REST API that works well if I host it locally. I followed this tutorial:
http://coenraets.org/blog/2012/10/creating-a-rest-api-using-node-js-express-and-mongodb/
How can I serve this on heroku or any other online platform so my app can execute CURL commands?
Here is the code I used:
https://github.com/taboada92/wham
Thanks
You need to add a Procfile to your project so heroku will know what to execute. If are new to Heroku + Node, I suggest going through the tutorial

Config Action Cable for Heroku - Error localhost:3000/cable

I have problem with my app with Action Cable on Heroku:
WebSocket connection to 'ws://localhost:3000/cable' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED
My production.rb:
config.action_cable.url = "wss://NAME.herokuapp.com/cable"
config.action_cable.allowed_request_origins = ['https://NAME.herokuapp.com', 'http://NAME.herokuapp.com']
I tried to specify the server in the cable.js as well:
#App ||= {}
App.cable = ActionCable.createConsumer("wss://NAME.herokuapp.com/cable")
I tried to change it in development.rb just in case but nothing helps. The Heroku is still trying to connect to localhost.
Another weird thing that has nothing in common with it I think, is that the app is not able to process some js code like: alert('test') or console.log("haha") despite of some js code works and I tried assets:precompile as well.
In localhost, everything works perfectly. Any idea what can be wrong with heroku and the setting?
While ActionCable was in development, I remember you had to startup 2 servers for the cable connection and for Rails. I don't think that is still needed for the final release.
My guess is that you don't have Redis provisioned on your Heroku instance, whereas in Production, ActionCable relies on Redis for it's server communication.
To fix this, you should do the following:
heroku addons:add redistogo
heroku config | grep REDISTOGO_URL
In your config/cable.yml, set the Redis url to the one given. I guess you should also be able to use ENV['REDISTOGO_URL'] in place of the url.
Let me know if that helps.
If it's working locally but not remotely it may be an SSL problem. Make sure you properly set up an SSL endpoint for the secure websocket (wss):
https://devcenter.heroku.com/articles/ssl-endpoint
Also, there is an excellent blog post on Heroku about how to set up Action Cable: https://blog.heroku.com/real_time_rails_implementing_websockets_in_rails_5_with_action_cable. Alas, the article does not mention the necessity of setting up an SSL endpoint for the Heroku deployment to work.

Categories