Can't deploy Flask application to Google App Engine with web3 library - google-app-engine

If I include the line from web3 import Web3 and deploy my flask server to app engine it says deploy successful, but when I open the page in browser I get the error: 502 bad gateway (nginx).
If I run it locally everything works fine.
Why could this be happening?
I would appreciate any help!

Most likely it wasn't installed in production(it works in local environment because it's installed in your local environment).
You need to include it in your requirements.txt file and then Google will install it when your App is first started

Related

Swagger plugin issue on GCP - Strapi

I'm using the Swagger plugin for Strapi. It works fine on localhost, but when I deploy to App Engine it fails.
When accessing the /documentation page from the Strapi admin panel on a GCP App Engine (Standard) instance, I am seeing the below errors in GCP logs and Page not found with a 404 error.
error Error: EROFS: read-only file system, open '/workspace/extensions/documentation/public/index.html'
The documentation plugin was installed in my LOCAL development environment and docs compiled before deploying to GCP App Engine. Locally it works fine.
Steps to reproduce the behavior
launch your Strapi project
active the Swagger documentation plugin
request the documentation locally (it will work)
upload the Strapi project to Google App Engine (gcloud command or whatever)
visit the documentation (https://YourGoogleProject.appspot.com/documentation/v1.0.0)
System
Node.js version: v14.17.6
NPM version: 8.1.2
Strapi version: v3.6.8
Database: MongoDB

Start React app using domain instead of localhost

I start my React app using:
npm start
This starts the app on localhost:3000
I would like to have it start with a domain instead of localhost. When testing locally, I have a local domain (example mydomain.com) set to IP address 127.0.0.1. This allows me to use the actual domain in code when making requests to the backend. Without this, my code would need to support both localhost and my domain and swap them out in production.
npm start is only a command to run your react app in development mode.. for faster build and publish functionalities..
So for production, you will be using npm build to get a production build for the same. This won;t be automatically deplyed or hosted on your localhost:3000.
So production deployment you will have to host your compiled build files using IIS or some hosting application. There you can configure your preferred DNS, whcihever domain name you would want to use.
You can customise the url for deployment for development.
In your .env.development add this line
HOST='mydomain.com'
If you want to deploy at https, add this line also in same file
HTTPS=true

How can I deploy React App to GoDaddy domain

I am new to using Reactjs, I just finished a project for a client and I need to upload it to a domain on GoDaddy. I ran npm run build already and I now have a build folder. I'm just not sure how to proceed. Can somebody please help me?
A domain name is not enough, you need to host your application somewhere. You can use netlify or zeit (both have free tiers) to deploy your application. After deploying the app you can link your domain to navigate to the application.
There's a few options, but heres a simple one to get you up and running quick. Upload to github repo and link your github account to netlify. In the netlify account deploy your project which will show at a random netlify domain. Change the nameservers in netlify to point to your godaddy domain and your app is live.

"Invalid Host header" in a React app deployed to IBM Cloud

I have developed a very simple demo Todo List app (Express + React), according to Brad Traversy's YT tutorial and successfully deployed this app to Heroku, where it is up and running. However, when I deployed the same exact code to IBM Cloud, I only got a blank screen with a sentence Invalid Host header.
Some more context:
I've used create-react-app in the root of my project
There is a proxy between the server and the React client
I'm deploying a production version that serves the static files:
// Serve static assets if in production
if (process.env.NODE_ENV === 'production') {
app.use(express.static('client/build'))
app.get('*', (req, res) => {
res.sendFile(path.resolve(__dirname, 'client', 'build', 'index.html'))
})
}
Build and Deploy phases in my Deployment Pipeline in IBM Cloud pass with no problem
I have googled and tried to solve this using the approach the official create-react-app docs suggest:
HOST=mypublicdevhost.com
DANGEROUSLY_DISABLE_HOST_CHECK=true
Some people asked a similar question on Stack Overflow, too:
Invalid Host header when running Create React App on localhost subdomain
"Invalid Host Header" in When running React App
How do I fix an Invalid Host Header error when deploying my react app to Heroku?
None of the answers helped, however.
I've come to a conclusion that it is an IBM Cloud-specific issue. Does anyone know the possible cause of this? Are there any limitations IBM Cloud has that prevents my app from loading correctly?
Any help will be appreciated.
EDIT:
The script for the Build phase:
export PATH=/opt/IBM/node-v6.7.0/bin:$PATH
npm install
npm run build
The script for the Deploy phase:
cf push "${CF_APP}"
A working solution is to use http-proxy-middleware to manually set up the proxy. Please see an explanation here: deploying create-react-app to heroku with express backend returns invalid host header in browser
Here is a minimal working example: https://github.com/sehailey/proxytest
and here is that example deployed: https://proxytest2.herokuapp.com/
If you are in production mode and have a domain, make a file in your root client directory named .env.production. Inside this file write this
HOST=yourdomain.com
No need to write any code, this is the right way to get rid of this error.
Docs

Can't get the Go Guestbook demo for Google App Engine Managed VM to run locally

I'm following the instructions on this page: https://cloud.google.com/appengine/docs/go/managed-vms/ trying to get the example guestbook demo shown here to work: https://github.com/golang/appengine/tree/master/demos/guestbook
The demo works when deployed, but not when run locally. Running locally gives following error in the browser when hitting localhost:8080: service bridge HTTP failed: Post http://10.0.2.2:41019/rpc_http: dial tcp 10.0.2.2:41019: i/o timeout
The error occurs when trying to access the datastore. The debug statement is DEBUG: Container: f18ca4d19536: 2014/12/31 03:08:22 ERROR: GetAll: service bridge HTTP failed: Post http://10.0.2.2:36788/rpc_http: dial tcp 10.0.2.2:36788: i/o timeout which is generated when the query.GetAll function fails.
Here are the statements I used to prepare to run the guestbook demo:
gcloud config set project <project name>
gcloud components update app
gcloud components update gae-go
goapp get google.golang.org/appengine
gcloud preview app setup-managed-vms
remove the "application: vm-guestbook" line from app.yaml
add "apt-get update" to the generated Dockerfile
gcloud preview app run app.yaml
Any ideas what's wrong? If I deploy the app using gcloud preview app deploy app.yaml it works fine. But I'd really like to figure out how to run Managed VM apps locally.
I should mention that I'm able to run the helloworld demo locally. The difference is the helloworld demo doesn't access the datastore. Also, I'm running on Ubuntu 14.04.
It turns out that your configuration is not currently supported.
We currently require the use of boot2docker and VirtualBox even on Linux.

Resources