I am trying to configure loopback4 with firestore data source using loopback-connector-firestore connector. when i am trying to post it is showing error code 500 with Error: Internal Server Error. Please tell me where i am exactly doing wrong.
It is simple.
First follow the steps to create datasource running the console command lb4 datasource.
When the command line ask you for the connector select other.
When the command line ask you for the connector's package name paste this loopback-connector-firestore. Please note that all connector for loopback 3 must work in loopback 4.
Then you should use a service account. Go to Project Settings > Service Accounts and press the Generate new private key button, in the Google Cloud Platform Console. Generate a new private key and save the JSON file.
Then in the src/datasources project folder open your new datasourceName.datasource.json file and add the following keys that you can find in the downloaded JSON file from the Google Cloud Platform in the previous step:
{
"projectId": "",
"clientEmail": "",
"privateKey": "",
"databaseName": "Optional, Default: projectId"
}
That is all. Now, if you have models, repositories and controller previously created you can run npm start, open the explorer and test your endpoints.
Regards.
Related
My realtime database URL is like https://myprojectid.firebaseio.com
When I start my node.js server I have error message :
#firebase/database: FIREBASE WARNING: Firebase error. Please ensure
that you have the URL of your Firebase Realtime Database instance
configured correctly.
(https://myprojectid-default-rtdb.firebaseio.com/)
My Firebase config is :
# Firebase
apiKey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXx
authDomain=myprojectid.firebaseapp.com
databaseURL=https://myprojectid.firebaseio.com
projectId=myprojectid
storageBucket=myprojectid.appspot.com
messagingSenderId=00000000000000
appId=1:0000000000000:web:000000000000000
When I'm trying to debug npm library, I can see that namespace is indeed "myprojectid-default-rtdb" but can't find where to change it.
I tried to set databaseURL with query string ?ns=myprojectid but not better.
By searching on Google I could read :
For recently created Firebase projects the default database URI
usually has the format https://
-default-rtdb.firebaseio.com. Databases in projects
created before September 2020 had the default database URI
https://.firebaseio.com. For backward compatibility
reasons, if you don’t specify a database URI, the SDK will use the
project ID defined in the Service Account JSON file to automatically
generate it
Could you help me to find a solution please?
There's no way to change the name of the default database instance that is created in your Firebase project. If your project is on the paid plan, you can add additional database instances where you fully control the name, but not for the default one.
You will have to update your project configuration to use the correct database URL. If the database in the US data center, that'd be:
databaseURL=https://myprojectid-default-rtdb.firebaseio.com
API Name:
TextModerator
have Azure Subscription and I created the cognitive service, and from a c# console, I'm trying to test the TextModerator project.
When this line is called:
var screenResult =
client.TextModeration.ScreenText("text/plain", new MemoryStream(Encoding.UTF8.GetBytes(text)), "eng", true, true, null, true);
I got the following message:
Microsoft.CognitiveServices.ContentModerator.Models.APIErrorException
: 'Operation returned an invalid status code 'NotFound''
the endpoint is like this:
https://contentmoderator-****.cognitiveservices.azure.com/contentmoderator
Any Idea?
Saad
You can use the following base endpoint for your specific Region(ex:westus).
https://westus.api.cognitive.microsoft.com.
Install the client library:
Within the application directory, install the Content Moderator client library for .NET with the following command:
dotnet add package Microsoft.Azure.CognitiveServices.ContentModerator --version 2.0.0
If you're using the Visual Studio IDE, the client library is available as a downloadable NuGet package.
Please follow the below document for Moderate Text.
https://learn.microsoft.com/en-us/azure/cognitive-services/content-moderator/dotnet-sdk-quickstart#setting-up
Please follow the API Reference for more information.
Is there any way to rename Google Apps Script project using API? I can't find any appropriate method for this.
UPD: I want to change Project's name like
You can modify the project name of the container-bound script type using Drive API. In order to use this, please retrieve the project ID, retrieve access token and enable Drive API.
End point :
PATCH https://www.googleapis.com/drive/v3/files/### project ID ###
Request body :
{
"name": "### Modified name ###"
}
Note :
In Google Drive, the project name is the same to the filename of the project.
Unfortunately, in the current stage, the project ID cannot be retrieved from Spreadsheet. But by the recent update, the file ID of Spreadsheet got to be able to be retrieved from the project of the container-bound script type. I would like to expect that the project ID will be retrieved from Spreadsheet in the future.
Reference :
Files: update
So I am new to IBM Bluemix and all of their products and I am trying to do this project http://www.ibm.com/developerworks/library/ba-muse-toycar-app/index.html . I have done all of the modifying of the car and everything I am just having issues with the codes.
I have a few specific questions on part 2 step 2.b when you are entering in the information for the Cloudant database what information do I put in for the cradle connection and how do I acquire that information.
Second when I go to deploy the app Part 2 Step 2.4 how do I navigate to the application directory? I have looked at the help and googled to no avail. So if we fix these things I am hoping that I will be able to deploy the application. However currently when I go to deploy it I get this error.
cf push braincar
Updating app braincar in org ccornwe1#students.kennesaw.edu / space dev as myemailaddress#gmail.com...
OK
Uploading braincar...
FAILED
Error uploading application.
open /Users/codycornwell/.rnd: permission denied
>>
I am green to all this so any help and explanation to understand it is greatly appreciated! Thanks!
In the tutorial's part 2, step 2.b, you need to specify your Cloudant credentials. There are several ways to get Cloudant credentials, but I'll focus on doing it within the context of Bluemix and the cf command line tool.
You will first need to create a Cloudant service instance, then create a set of service keys (credentials) and then view them.
Create a Cloudant service instance named myCloudantSvc using the Shared plan:
$> cf create-service cloudantNoSQLDB Shared myCloudantSvc
Create a set of service keys (credentials) named cred1:
$> cf create-service-key myCloudantSvc cred1
View the credentials for the service key you just created
$> cf service-key myCloudantSvc creed
With the last step above, you should see output which provides you with the username, password and host values that you'll need to place into your app.js code. It should look something like the following:
{
"host": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx-bluemix.cloudant.com",
"password": "longSecretPassword",
"port": 443,
"url": "https://xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx-bluemix:longSecretPassword#xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx-bluemix.cloudant.com",
"username": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx-bluemix"
}
For your second question, it looks like you're performing the cf push from your $HOME directory (as mentioned in the comment by #vmovva). By default, the cf push command will send all files in the current directory to Bluemix/CloudFoundry.
Try running the command from the directory where your source code is located to reduce the files pushed to Bluemix. If your source code is intermingled in your $HOME directory, move your source into a different directory and then push from that directory.
Following this blog with steps by steps http://www.windowsazure.com/en-us/documentation/articles/web-sites-dotnet-deploy-aspnet-mvc-app-membership-oauth-sql-database/#setupdevenv
If I run from my local machine then i see the data which is coming from Windows Azure db and i can add and update or delete ... perfectly working fine but the problem is when I publish my application to Windows Azure and I able to see my page and all the static pages are working fine but except one page which is interacting with database.
here is my web.config connection string:
<add name="DefaultConnection" connectionString="server=tcp:* insert server name*.database.windows.net,1433;Database=* insert database name *;User ID=*insert username *#* insert server name*;Password={*insert password here *};Trusted_Connection=False;Encrypt=True;Connection Timeout=30;" />
I get this message when i try to access the page from http://XXXX.azurewebsites.net/Employee
Error Message:
Migrations is enabled for context 'ApplicationDbContext' but the database does not exist or contains no mapped tables. Use Migrations to create the database and its tables, for example by running the 'Update-Database' command from the Package Manager Console.
Seems that your database cannot be created automatically. The fastest way to fix that is to follow the suggestion from your error message. Open your Package Manager Console with the project, which contains the connection string and the Configuration.cs (your migrations), selected as the startup project and run Update-Database. It could be that you must pass some parameters to this command if you have changed something on your migrations.