postgreSQL's prisma deploy command - node.js

I am using Nodejs, graphQl, Prisma, docker and PostgreSQL,
whenever I change Schema the I have to deploy it, but it gives error as follow
ERROR: You can not deploy to a service stage while there is a deployment in progress or a pending deployment scheduled already. Please try again after the deployment finished
"code": 4008,
"status": 200
then I wait for a few minutes and try again the result is same, I tried a lot but the result is same

This happens when there is an unapplied migration in the management schema.
To resolve this follow the following steps:
Connect to your database using a GUI(like tableplus.io))
Change your database schema to management schema
Goto the migration table
Delete the last row
Then try to redeploy your service.

Related

Creating Azure Elastic job agent throwing "DatabaseDoesNotExist" Error

I am creating Azure Elastic jobs agent and I am attaching a newly created, fresh Azure SQL Database with it, but when I execute the process it gives me this error
"error": {
"code": "DatabaseDoesNotExist",
"message": "Database 'mydatabase' does not exist."
}
Previously we were created it successfully
Update:
Actually, the issue was we were selecting the wrong database (hyperscale) type. When select the following tier it worked perfectly
I tried to deploy the same resource and it deployed successfully for me. Please find the screenshot for the same below. I just simply created the SQL server on Azure, then create a Database inside it and used the same database in Elastic Job.
As per the official document Troubleshoot common Azure deployment errors, the Conflict error occurs when:
You're requesting an operation that isn't allowed in the resource's
current state. For example, disk resizing is allowed only when
creating a VM or when the VM is deallocated.
You can check if your database has been deployed successfully without any error. And once it is deployed, you create the elastic job agent using that database. Make sure your database configuration match the elastic job requirement and you have appropriate permissions.

Azure PostgreSQL: it is not possible to remove database through Azure CLI

I have created pipeline using Azure DevOps for Azure PostgreSQL database.
What actually pipeline do?
Connect to PostgreSQL;
Remove database db_test from PostgreSQL using Azure CLI;
az postgres db delete -g my_group -s database_here -n db_test --yes
However, I cannot do this due to error:
An unexpected error occured while processing the request.
Then, I was trying to remove the database using psql, but with no luck due to existing connections to database.
From my point of view - Azure CLI must handle such issues and remove database or pass correct error message to me. For example it would be great if parameter --force will be implemented.
I have removed all connections to database using the following syntax in a bash script:
psql "host=database_here port=5432 dbname=postgres user=postgres#database_here password=ReallyStrongPassword sslmode=require" -c "REVOKE CONNECT ON DATABASE db_test FROM PUBLIC; SELECT pg_terminate_backend(pg_stat_activity.pid) FROM pg_stat_activity WHERE pg_stat_activity.datname = 'db_test';"
and added DROP database action additionally to my pipeline:
psql "host=database_here port=5432 dbname=postgres user=postgres#database_here password=ReallyStrongPassword sslmode=require" -c "DROP database db_test;"
But I didn't remove AZ CLI database removal step from pipeline and it has failed with the following output:
Operation failed with status: 200. Details: Resource state Failed
I think on this step, AZ CLI should return something like: "Database does not exist." just as informative message.
How to properly handle such situations on the Azure side?
Does az postgres db show show the database details? Please check if this is happening due to this behaviour, albeit the discussion in the quoted thread is in context with a SQL database.
If the issue still persists, please feel free to drop your feedback here open an issue with our GitHub repo for our internal Team to take a look at.
Thanks for the feedback!

Not able to open Azure SQL Server DB immidiately after the creation

I am trying to automate the tenant DB creation in Azure SQL Server.
DB has been created/copied as
CREATE DATABASE {0} AS COPY OF {1} ( SERVICE_OBJECTIVE = 'S2' )
Immediately adding a record to one of the table in the same. Getting error as:
Function completed (Failure, Id=1046eae2-c07a-4eee-9a1d-886e89ab5071)
A ScriptHost error has occurred
Exception while executing function: Functions.CreateTenant. .Net SqlClient Data Provider: Database 'tenant8' on server 'dbserver' is not currently available. Please retry the connection later. If the problem persists, contact customer support, and provide them the session tracing ID of '8AF58081-8F25-4B7F-83E3-63AFFC13C8CB'.
Exception while executing function: Functions.CreateTenant
Executed 'Functions.CreateTenant' (Failed, Id=1046eae2-c07a-4eee-9a1d-886e89ab5071)
Function had errors. See Azure WebJobs SDK dashboard for details. Instance ID is '1046eae2-c07a-4eee-9a1d-886e89ab5071'
Looking at the error message, it seems that you are trying to insert data before the database tenant8 has been provisioned and deployed. Deploying a database takes any time between a few dozens seconds to a few minutes. A description of the steps involved in this operation can be found on this blog post by Steve Mark. Please let us know if the deployment takes more than 5 minutes.

Is there a Atlas api call to get the status of terraform run?

I am using atlas to execute my terraform files. I configured terraform remote to my atlas environment and then used terraform push to upload my files. This action invoked atlas to execute the terraform and created my aws resources successfully after 2 mins. I would like to automate this process and am looking for atlas api calls to get the status of my run.
I couldn't find anything in their documentation. Is it possible to get the run status via an api call ?
Appreciate your help!
Response from Hashicorp support:
Here is the extent of the Terraform API. You are able to queue plans, but at this time retrieving the status of the of a plan/apply is not possible.

Unable to Upgrade Deployment in Azure

I am getting the following error when I run Continuous Deployment in TFS:
The polling operation Upgrade Deployment failed with the error: (400)
BadRequest.
Error Code: BadRequest
Message: Your role instances have recycled a number of times during an
update or upgrade operation. This indicates that the new version of
your service or the configuration settings you provided when
configuring the service prevent the role instances from running.
Verify your code does not throw unhandled exceptions and that your
configuration settings are correct and then start another update or
upgrade operation.
Also, I have checked the VM on where the build is and on the Microsoft.Compute.VMAccessAgent extensions I got this error:
Cannot update Remote Desktop Connection settings for built-in
Administrator account. Error: Object reference not set to an instance
of an object.
Has anyone come across this? The build continues to run and does not stop.
The "Your role instances have recycled a number of times during an update or upgrade operation" error message is always prompted when Windows Azure SDK is upgraded. The workaround is go to Project Properties and upgrade to the correct version SDK.
Please have a check on this blog for the thoughts on how to trouble shoot it:
http://blogs.msdn.com/b/cie/archive/2013/12/21/role-just-recycles-after-sdk-upgrade.aspx
Also a blog series about troubleshooting on common issues: Your role instances have recycled a number of times during an update or upgrade operation

Resources