AssertionError: No api proxy found for service "xmpp" - python

I am trying to run gae app without dev_appserver.py, and have following error
AssertionError: No api proxy found for service "xmpp"
room = webrtc.Room.get_by_key_name(room_key)
I found in the app.yaml inbound_services:
- channel_presence
How to enable channel_presence directly in application.py

Unless otherwise specified, libraries included with the App Engine SDK are expected only to work within the App Engine environment. You cannot just import the XMPP library included with the App Engine SDK and expect it to work in a non-GAE application.

Related

How to link static folder in Google app engine with a storage bucket

Created a new python Flask app-engine python project and want to use the static files from Google cloud storage. I am using this yaml.file:
runtime: python
env: flex
entrypoint: gunicorn -b :$PORT main:app
runtime_config:
python_version: 3
Where in the app engine do you link to storage https://storage.googleapis.com/<your-bucket-name>/static/ with /static in the app-engine? It is not clear from the documentation.
You can't use file stored on Google Cloud Storage as static folder in your App Engine environment. The solution proposed by the documentation is to have 2 sources (2 URL): one for the static file on GCS, the other for the backend on App Engine Flex.
The main issue with this design is the CORS issues. Personally I prefer another design.
Set up a HTTPS load balancer
Create a bucket backend to serve your source from GCS
Create a serverless NEG to serve your dynamic backend (on App Engine flex)
Customize your Path rule to route correctly the ressource to your respective backends
Set a unique DNS in front of your HTTPS Load Balancer (no CORS management in this case)

ERROR: An app.yaml (or appengine-web.xml) file is required to deploy this directory as an App Engine application

When I try deploying my Python code through Cloud Build to Google App Engine (GAE) I receive the following ERROR message:
ERROR: An app.yaml (or appengine-web.xml) file is required to deploy this directory as an App Engine application
ERROR: (gcloud.app.deploy) [/workspace] could not be identified as a valid source directory or file.
ERROR: build step 0 "gcr.io/google.com/cloudsdktool/cloud-sdk" failed: step exited with non-zero status
Can someone explain what might be causing this error?
A Python app in App Engine is configured using an app.yaml, that contains CPU, memory, network and disk resources, scaling, and other general settings including environment variables. From looking at this error message your app.yaml appears to be missing. You can read more about how to configure your application here: Configuring your App with app.yaml

Deploying flask app on cpanel, INTERNAL SERVER ERROR when changing requesting other than base url

I want to deploy my flask-restx application on a shared hosting. Since I am beginner in deployment, I followed a video tutorial from youtube.
I did step by step by following this tutorial.
For those who do not want to go through the tutorial, I am writing the steps:
I created an application from the Python cPanel
Initial set up in Cpanel
Then I opened terminal and changed my venv and installed flask by "pip install flask"
Project Structure
filas_folder/
├──public
├──tmp
│ └──restart.txt
├──app.py
└──passenger_wsgi.py
app.py looks like
from flask import Flask
app = Flask(__name__)
#app.route("/")
def main_():
return "flask is running"
#app.route("/user")
def main_2():
return "user is running"
if __name__ == "__main__": app.run()
Restart app from cpanel
passenger.py looks like
import imp
import os
import sys
sys.path.insert(0, os.path.dirname(__file__))
wsgi = imp.load_source('wsgi', 'app.py')
application = wsgi.app
when I open www.example.com
flask is running
But when I open www.example.com/user
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator at webmaster#example.com to inform them of the time this error occurred, and the actions you performed just before this error.
More information about this error may be available in the server error log.
Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.
My system has cloudlinux and uses apache server. This is not the first deployment. Many wordpress and static websites are running on the server.
I opened apache logs at /usr/local/apache/logs/error_log
I get the error "Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace., referer" http://example.com/user"
Add the following to the top of your .htaccess file:
RewriteEngine on
RewriteRule ^http://%{HTTP_HOST}%{REQUEST_URI} [END,NE]
Got this info from: https://stackoverflow.com/a/63971427/10122266

"Connection in use" error in GCP app engine

I am new to GCP App engine. I am trying to make web server using flask on App engine. I tested the version of my code on localhost and it is working fine. But when I am trying to deploy it in the App Engine of GCP it is giving me this strange error "app logs".
error logs
Here is my code for the flask
app.run(threaded = True, host='127.0.0.1', port=80)
Thanks!!
You don't need to call app.run() in your main.py file -- App Engine will do that for you. Simply initialize the app variable in this file instead.

Google App Engine Devserver + dispatch.yaml (gcloud)

I am trying to start my app using the new cloud SDK preview (gcloud preview app run DIRNAME) and the response is:
INFO: Starting API server at: http://localhost:51695
INFO: Starting module "api" running at: http://localhost:8080
INFO: Starting module "default" running at: http://localhost:8081
INFO: Starting admin server at: http://localhost:8000
The dispatcher is not running and I can't get a dispatcher service URL as described
here.
The dispatcher is fully function on production, but I just can't get it started via dev server.
How can i make Google Cloud SDK recognize dispatch.yaml?
The dispatch.yaml looks like this:
application: my-super-secret-app-id
dispatch:
- url: "*/"
module: default
- url: "*/_*"
module: api
The goal is to server all "regular" requests from the default module, and request begins with underscore to the "api" module.
Removing Google Cloud SDK completely and re-installing it's latest version solved the problem.

Categories