I have a non-GAE backend that's using the Remote API to access datastore. The only way to do this (without a proxy GAE service) is to use the GAE Remote API.
This works fine when connecting the Remote Context to a GAE production deployment, but what about GAE dev server?
I want to be able to test my changes locally before deploying anything. Is there a way to connect the remote API to a local GAE dev server datastore?
Relevant sample code:
func getRemoteCtx(ctx context.Context, r *http.Request) (context.Context, error) {
ts, err := google.DefaultTokenSource(ctx,
"https://www.googleapis.com/auth/appengine.apis",
"https://www.googleapis.com/auth/userinfo.email",
"https://www.googleapis.com/auth/cloud-platform",
)
if err != nil {
log.Fatal(err)
}
hc := oauth2.NewClient(ctx, ts)
host := "myapp.appspot.com"
log.Printf("create remote context with host: %s", host)
return remote_api.NewRemoteContext(host, hc)
}
Check out the host. Is there a way to set this to a local GAE dev server?
Related
I'm trying to use a PostgreSQL database with Prisma for the first time in my project. However, I'm failing to connect to the Cloud SQL instance I created on Google Cloud. When I run npx prisma db push, I'm getting the error:
Please make sure your database server is running at `34.86.23.139`:`5432`.
ERROR Command failed with exit code 1: prisma db push
I made sure the database server was running, and was able to successfully connect to it using Cloud Shell. The public IP address of the server is 34.86.23.139, the name of the database is test-db, and the connection name is test:us-east4:test-db. Given that the connection string should be in the formal of postgresql://USER:PASSWORD#HOST:PORT/DATABASE, I made this within .env:
//.env
DATABASE_URL="postgresql://myemail#gmail.com:mypassword#34.86.23.139/test-db"
// I also tried DATABASE_URL="postgresql://myemail#gmail.com:mypassword#34.86.23.139/test:us-east4:test-db" but same error.
And this is my schema.prisma:
// prisma/schema.prisma
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
model Thing {
id Int #id #default(autoincrement())
name String
}
Please let me know what I'm doing wrong. I'm a newbie so go easy on me :) Thank you in advance.
Cloud SQL instances are configured to block all traffic to the public IP unless you specifically allow an IP using Authorized Networks.
Alternatively, you can run the Cloud SQL Auth Proxy next to your application and it will create a listener on localhost that proxies traffic to your instance without having to configure Authorized Networks.
I have ported a ETL utility I wrote over from C# to Go that performs a reporting task. The C# app is able to connect to the SQL Express server just fine but the Go app is struggling to find the named instance of SQLEXPRESS.
I have used both versions:
server=<server>\<instance>;user id=<user>;password=<passw>;database=<database>;
sqlserver://<user>:<passw>#<server>/<instance>?database=<database>
...in various iterations when executing:
db, err := sql.Open("sqlserver", connString)
if err != nil {
panic(err)
}
... and in both cases I get the the following error back:
no instance matching 'SQLEXPRESS' returned from host 'localhost'
I have deployed asp .net core api app on local IIS Manger when i call action that need to retrieve data from sql database does not work,i opned C:\inetpub\logs\LogFiles\W3SVC3 found 404 not found error ,
i found another error in my log as Login failed for user 'IIS APPPOOL\service' ,
but when i call another action that returns local data it works fine here is my connection string
"ConnectionStrings": {
"ERPConnection": "server=.; user Id=ssa;password=12345678;database=dbname;trusted_connection=true;MultipleActiveResultSets=true"
},
and my application pool is not manged code :
Where is your SQL Server instance hosted? If its localhost try using the full local host domain name.
I am trying to use Flask SQLAlchemy to establish a database connection between Google App Engine and Google Cloud SQL.
I am able to establish the connection in a Flex environment but not Standard whenever I deploy. I am not sure why this is the case. I am receiving this error response from the Error Logs:
OperationalError: (pymysql.err.OperationalError) (2003, "Can't connect to MySQL server on 'localhost' ([Errno 97] Address family not supported by protocol)")
This is the connection string I am using to connect to the Cloud SQL database
app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql://<username>:<password>#/<database>?unix_socket=/cloudsql/<instanceName>'
When testing and developing locally, I am able to use this connection string to connect to the database through the cloud_sql_proxy but this connection string fails when I deploy and attempt to access it externally.
I've looked through similar questions but haven't seen any that reference this specific error response yet.
I am using the Second Gen Cloud SQL version
I have an Exchange Server running in a remote machine.
We also have an application that connects to this Exchange Server through ActiveDirectory and Independentsoft's WebDav.
This works perfectly when I run the application locally, but if I install it in the machine where the Exchange Server is running I only have connectivity with Active Directory, through WebDav I can't access any mailbox with the following URL template "LDAP://MyDomain/exchange/test#test.com", the Exist() method returns false.
Using this code:
"
var _Credential = new NetworkCredential(domain.AccessUsername, domain.AccessPassword);
var _WebdavSession = new WebdavSession(_Credential);
_WebdavSession.UserMailbox = _Url;
var _Resource = new Resource(_WebdavSession);
_Resource.Exists(); <-------
"
In the other hand, I installed the application in another machine and tried to do the exact same but I couldn't connect by ActiveDirectory, I get a "The server is not operational" (0x8007203A) error; through WebDav I get "System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond".
All this with exactly the same LDAP URL, credentials, and everything.
Any help would be appreciated.
In the end I solved it, it seems to be a problem with Amazon servers: you can't connect from one to another, but you CAN connect to 127.0.0.1 (but not, for some reason, to localhost).