I am trying to create a Database in InfluxDB using API call from Postman. I have setup the configuration as mentioned in the InfluxDB Documentaion.
When I tried to do a POST call to create a DB, I end up with the below error:
{
"results": [
{
"statement_id": 0,
"error": "not implemented: CREATE DATABASE"
}
]
}
Related
I have set up Stepzen as described in the Getting Started Docs. I get the following error when running stepzen start:
{
"data": {
"getProfilesList": null
},
"errors": [
{
"message": "database error: can't prepare the statement for execution failed to connect to `host=postgres user=root database=`: hostname resolving error (lookup postgres on 10.97.0.10:53: no such host)",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"getProfilesList"
]
}
]
}
The message shows wrong hostname, user and empty database, although my config file has the correct credentials:
configurationset:
- configuration:
name: postgresql_config
uri: postgresql://postgres:[My Password]#[My Supabase DB Host]/postgres
I have also tried to connect to the DB directly from a GUI client and the connection was successful.
Why this issue is coming up when trying to connect from Stepzen Graphiql explorer running on localhost?
Postgres requires the password to be URL Encoded when using some characters that have a special meaning.
You can learn more about percent-encoding to handle special characters in Postgres passwords here: How to handle special characters in the password of a Postgresql URL connection string?
I'm starting in Azure Function & Cosmo DB.
I created in the Azure Portal a function app, then I followed the guide to get started in VS Code:
npm install -g azure-functions-core-tools#4 --unsafe-perm true
Then New Project
Then New function, selected the HTTP trigger template
When running F5 and deployed, it work.
Then I created, in the portal, a "Azure Cosmos DB API for MongoDB" database. I followed this to publish a document when having my method called:
https://learn.microsoft.com/en-us/azure/azure-functions/functions-add-output-binding-cosmos-db-vs-code?tabs=in-process&pivots=programming-language-csharp
So my current result is:
a function:
namespace TakeANumber
{
public static class TestFunc
{
[FunctionName("TestFunc")]
public static async Task<IActionResult> Run(
[HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequest req,
[CosmosDB(databaseName: "cosmodb-take-a-number", collectionName: "take-a-number", ConnectionStringSetting = "cosmoDbConnectionString")] IAsyncCollector<dynamic> documentsOut,
ILogger log)
{
log.LogInformation("C# HTTP trigger function processed a request.");
string name = req.Query["name"];
string requestBody = await new StreamReader(req.Body).ReadToEndAsync();
dynamic data = JsonConvert.DeserializeObject(requestBody);
name = name ?? data?.name;
string responseMessage = string.IsNullOrEmpty(name)
? "This HTTP triggered function executed successfully. Pass a name in the query string or in the request body for a personalized response."
: $"Hello, {name}. This HTTP triggered function executed successfully.";
if (!string.IsNullOrEmpty(name))
{
// Add a JSON document to the output container.
await documentsOut.AddAsync(new
{
// create a random ID
id = System.Guid.NewGuid().ToString(),
name = name
});
}
return new OkObjectResult(responseMessage);
}
}
}
A local.settings.json file with a cosmoDbConnectionString settings that contains a mongo db connexion string.
When I run the function, I get this:
[2022-04-21T17:40:34.078Z] Executed 'TestFunc' (Failed, Id=b69a625c-9055-48bd-a5fb-d3c3b3a6fb9b, Duration=4ms)
[2022-04-21T17:40:34.079Z] System.Private.CoreLib: Exception while executing function: TestFunc. Microsoft.Azure.WebJobs.Host: Exception binding parameter 'documentsOut'. Microsoft.Azure.DocumentDB.Core: Value cannot be null. (Parameter 'authKeyOrResourceToken | secureAuthKey').
My guess is that it's expecting a Core SQL database, with another kind of access token.
My question:
Is it possible to connect to an azure CosmoDB for MongoDB from an Azure function?
If you're using out-of-the-box bindings, you can only use Cosmos DB's SQL API.
You can totally use the MongoDB API, but you'd have to install a MongoDB client SDK and work with your data programmatically (just like you'd do with any other code-oriented approach).
Since your sample code is taking data in, and writing out to Cosmos DB, you'd do your writes via MongoDB's node/c#/python/etc driver (I believe they still call them drivers), which effectively gives you a db.collection.insert( {} ) or something more complex.
More info about Cosmos DB bindings here.
I am trying to sync my Postgres database with Aws Elasticsearch using PGSync
I have defined a simple schema:
[
{
"database": "tenancyportal",
"index": "properties",
"nodes": [
{
"table": "properties",
"schema": "public",
"columns": ["id", "address"]
}
]
}
]
But when I am trying to bootstrap the database using
bootstrap --config schema.json
I get the following error:
elasticsearch.exceptions.NotFoundError: NotFoundError(404,
'index_not_found_exception', 'no such index [:9200]', :9200,
index_or_alias)
In the below screenshot, you will be able to see the GET URL for elasticsearch is completely wrong, I am not able to understand what config is causing it to be formed like that.
It looks like your AWS Elasticsearch URL is not constructed properly. This was adressed in a recent update to PGSync. Can you pull the latest master branch and try this again.
I use the Microsoft Azure Comos Emulator version 2.11.11.0. I start it with the command line:
CosmosDB.Emulator.exe /EnableMongoDbEndpoint=3.6
If I connect with my application to the MongoDB endpoint I receive the follow error:
com.mongodb.MongoCommandException: Command failed with error 1 (InternalError):
'[ActivityId=64bdb726-f138-4025-8d5b-ca23bbda384c] Internal error.' on server localhost:10255.
The full response is {"ok": 0.0, "errmsg": "[ActivityId=64bdb726-f138-4025-8d5b-ca23
bbda384c] Internal error.", "code": 1, "codeName": "InternalError"}
What this error means? What I need to do else to use the MongoDB API?
Failing ist the first write command:
'{"createIndexes": "fs.files", "indexes": [{"key": {"filename": 1}, "name": "filename_1", "ns": "admin.fs.files"}], "$db": "admin", "lsid": {"id": {"$binary": {"base64": "lFHKYPJ0Rq+ip587pl8YPQ==", "subType": "04"}}}, "$readPreference": {"mode
": "primaryPreferred"}}'
It was produces from the simple Java line:
collection.createIndex( new BasicDBObject( FILENAME, 1 ) );
PS: With MongoDb endpoint 3.2 this is working. It must be any problem with the emulator.
With the emulator Mongo API 3.6 there must be created the collection explicit. With the original MongoDB and the Mongo API end point 3.2 the collection will be indirect created if a Index is created or data are saved.
I'm using the Cloud 9 IDE to develop an application using MongoDB. I created a database called "appdata" at MongoLab and the following user:
{
"_id": "appdata.admin",
"user": "admin",
"db": "appdata",
"credentials": {
"SCRAM-SHA-1": {
"iterationCount": 10000,
"salt": "K/WUzUDbi3Ip4Vy59gNV7g==",
"storedKey": "9ow35+PtcOOhfuhY7Dtk7KnfYsM=",
"serverKey": "YfsOlFx1uvmP+VaBundvmVGW+3k="
}
},
"roles": [
{
"role": "dbOwner",
"db": "appdata"
}
]
}
Whenever I try connecting to the database through Cloud 9 Shell using the following command (given by MongoLab with my newly created user):
mongo ds057244.mongolab.com:57244/appdata -u admin -p admin
I get the following error message:
MongoDB shell version: 2.6.11
connecting to: ds057244.mongolab.com:57244/appdata
2015-11-22T05:23:49.015+0000 Error: 18 { ok: 0.0, errmsg: "auth failed",
code: 18 } at src/mongo/shell/db.js:1292
exception: login failed
Also, on my javascript file running on Cloud 9, while following this tutorial (which uses mongoose to access the DB) I got stuck on the post route for bears. Whenever I send a post request through postman with the specified fields set, the route doesn't return anything, neither a bear created nor an error message, which makes me think the problem is also failing to login to the database. The previous get request is working just fine and my code is the exactly same as the tutorial.
Does anyone know what the problem in any of the cases and what I need to do to solve them?
The shell problem was fixed updating it to the Database version (which was 3.0.3).
For the javascript files, I restarted the tutorial and made sure I downloaded all necessary dependencies with the most recent stable version (not the ones shown on the tutorial), after that the problem was solved.