Project architecture
Background
Trying to connect a DB to my NextJS project. Decided to use https://www.mockaroo.com/ to generate mock DB. Then used the Planetscale browser console to create the table and insert the values with the SQL generated by mockaroo.
Successfully have a table in Planetscale
Problem
When doing npx prisma studio
ERROR
Message: Error in Prisma Client request:
Invalid `prisma.mOCK_DATA.findMany()` invocation:
Can't reach database server at `us-east.connect.psdb.cloud`:`3306`
Please make sure your database server is running at `us-east.connect.psdb.cloud`:`3306`.
When doing npx prisma db pull
ERROR
Prisma schema loaded from prisma\schema.prisma
Environment variables loaded from .env
Datasource "db": MySQL database "MydbName" at "us-east.connect.psdb.cloud:3306"
✖ Introspecting based on datasource defined in prisma\schema.prisma
Error: P1001
Please make sure your database server is running at `us-east.connect.psdb.cloud`:`3306`.
scheme.prisma
generator client {
provider = "prisma-client-js"
previewFeatures = ["referentialIntegrity"]
}
datasource db {
provider = "mysql"
url = env("DATABASE_URL")
referentialIntegrity = "prisma"
}
.env
DATABASE_URL="mysql://{username}:{password}#us-east.connect.psdb.cloud:3306/MydbName"
Summary
I cannot connect to the Planetscale DB from my NextJS project without an ERROR connecting. I have researched this issue online and found people with the issue. But applying their changes did not fix anything i.e. https://github.com/prisma/prisma/issues/5132. For instance I tried appending ?ssl_mode=require&sslcert==us-east-1-bundle.pem to the DATABASE_URL but no changes.
I will attempt this fix soon: How do I connect to a server with SSL from node.js on localhost?
Related
I have turned on Application Insights on my app service. Everytime I try to run the app or login using the app it gives an error:
An error has occurred. Please call support or your account manager if this error persists
When i looked in the Application errors under Logging,I get the following:
System.ApplicationException: The trace listener AzureBlobTraceListener is disabled.
---> System.InvalidOperationException: The SAS URL for the cloud storage account is not
specified. Use the environment variable
'DIAGNOSTICS_AZUREBLOBCONTAINERSASURL' to define it.
Im assuming I need to add the following in the Configuration of the App Service:
{
"name": "DIAGNOSTICS_AZUREBLOBCONTAINERSASURL",
"value": <URL>,
"slotSetting": true
},
But what is the and where can i find it ? Or is there a different error causing the app to crash once application insights is enabled, has anyone experienced this ?
I can see you have configured DIAGNOSTICS_AZUREBLOBCONTAINERSASURL without providing the value.
Get the Blob service SAS URL value from the Storage Account.
In Azure Portal => Create a Storage Account.
Initially the option to generate SAS is disabled for me.
Navigate to your Storage Account => Shared access signature = > select Container and Object checkboxes.
An option to Generate SAS and connection string will be enabled.
Copy the Blob service SAS URL and provide the value in either local Configuration settings or in Azure App Service => Configuration => Application Settings.
In Azure App Service Settings
Save the settings and access the URL.
My question before is that once i generate Generate SAS and Conection string and copy to clip board.
Even if you generate the SAS again, the value will be same till here - https://yourSA.blob.core.windows.net/?sv=2021-06-08&ss=*****=co&sp=******&se=2022-12-05T14:.
Even we can add the SAS token in App settings automatically. Follow the below steps.
In Azure App Service => App Service logs = >set Application logging (Blob) to On and continue the steps to add the Storage Account. If you don't have create a new Storage Account.
"Unable to find mscorlib assembly reference:.
Make sure you are using the latest package references.
Update the framework version 4.7.2 to 4.8 in VS. Rebuild and Re-deploy the App.
I am using Prisma as ORM in my nextjs app. I am initiating the Prisma client in a lib file and importing the same where ever i need the instance. But still am getting the following error.
Error querying the database: db error: FATAL: too many connections for
role "qcjoaamjgbnxjx"
prisma-client:
import { PrismaClient } from '#prisma/client';
const prisma = new PrismaClient();
export default prisma;
You could try instantiating PrismaClient as shown here so that a new connection isn't created on every reload.
I got the same error in my local computer. but my error was due to I have opened too many panels in pgAdmin. my database is Postgres. after removing all panels. my issue is solved
I am trying to connect my Meteor application to Atlas MongoDB,
I am setting MONGO_URL and MONGO_OPLOG_URL as follows:
MONGO_URL="mongodb://username:password#host:27017,host:27017,host:27017/databasename?ssl=true&replicaSet=melee-shard-0&authSource=admin"
MONGO_OPLOG_URL="mongodb://username:password#host:27017,host:27017,host:27017/local?ssl=true&replicaSet=melee-shard-0&authSource=admin"
But, I am getting error while starting the Meteor app:
Error: Could not locate any valid servers in initial seed list
What am I doing wrong?
I have a ASP.NET application that uses application services to manage user roles. This application worked fine when I was using a local database. When I transitioned to Azure, the main data tables still work but I am unable have user's login or create new accounts because the Application table cannot be found. Previously, the application services created these tables automatically when using a local database. The connection string name appears accurate. This is my first attempt at Azure...is there something I'm missing?
The error is "The entity type Application is not part of the model for the current context"
For additional context: When I try to create the membership tables in the Azure database using aspnet_regsql.exe, I get the following error: "An error occurred during the execution of the SQL file 'InstallCommon.sql'. The SQL error number is 40508 and the SqlException message is: USE statement is not supported to switch between databases. Use a new connection to connect to a different database."
I have written the following code to create primary index in Couchbase server with my Symfony project.
// Establish connection
$cluster = new \CouchbaseCluster('http://ec2-ip_number.compute-1.amazonaws.com:8091'); // http://127.0.0.1:8091
$bucket = $cluster->openBucket("default");
$bucket->enableN1ql(array('http://ec2-ip_number.compute-1.amazonaws.com:8091'));
// Execute query
$query = 'CREATE PRIMARY INDEX `default-primary-index` ON `default` USING GSI';
$queryNql = \CouchbaseN1qlQuery::fromString($query);
$bucket->query($queryNql);
My couchbase cluster is created in amazon aws.
After run the above code, it shows me the error:
"LCB_NETWORK_ERROR: Generic network failure. Enable detailed error codes (via LCB_CNTL_DETAILED_ERRCODES, or via detailed_errcodes in the connection string) and/or enable logging to get more information
500 Internal Server Error - CouchbaseException"
I have tried it many times to solve this issue, but couldn't able to get any solution.
Can you run the CREATE INDEX command from the web-console (query-tab). Make sure there are no connectivity/network issues between client & server, or between various Couchbase services.
Did you retry after enabling logging?? What error do you see in logs?
Provide more details on couchbase version and AWS/cluster setup?
-Prasad