Error facing while importing user from json file in keycloak - keycloak

I am trying to import users in keycloak through the below json file via Keycloak UI admin console:
[{
"Email":"abc#abc.com",
"Username":"abc#abc.com",
"FirstName":"ABC",
"LastName":"XYZ",
}]
but I am getting the error message as:
Error! Unable to parse JSON file.
Is there some issue with my json file?

You have a trailing "," (comma) in your JSON.
[{
"Email":"abc#abc.com",
"Username":"abc#abc.com",
"FirstName":"ABC",
"LastName":"XYZ", <-- this is wrong
}]

Related

Error when querying records with # character in WSO2 Data service via MongoDD

In the data service project in Wso2 Integration Studio, I want to query from mongo DB and print the result.I cannot run a data containing # character through wso2 integration studio. My query is running via Mongo Compass.When I query the data that does not contain # characters, it works in wso2 integration studio.
The data in mongo is as follows:
{
"_id": {
"id": "urn:ngsi-ld:Building:47445",
"type": "https://uri.fiware.org/ns/data-models#Building",
"servicePath": "/"
}
}
Below is my query that pulls the data from mongo in wso2:
<expression>
collectionName.count({"_id.type": 'https://uri.fiware.org/ns/data-models#Building'})
</expression>
The error I get is this:
Caused by: java.lang.IllegalArgumentException: Not enough parameters passed to query: {"_id.type": 'https://uri.fiware.org/ns/data-models#Building'}
# denotes an input parameter mapping in a Mongo query, Hence it's mandatory to parse an input parameter to the query if you have a #. One way to get around this is to remove the # when inserting the record. Another option is to use a regex pattern like below to count the records.
collectionName.count({'_id.type': {'$regex': 'data-models.*.Building'}})
You can read more on regex patterns here.

Hostname resolving error in Stepzen Graphiql explorer when connecting with Supabase Postgresql database

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?

How to get secret from Secret Manager in serverless

I configured a secret to my RDS database. Its name is: qa/aurora
I am trying to make the reference on my serverless.yml in the environment settings like this:
DB: ${ssm:/aws/reference/secretsmanager/qa/aurora~true}
I want to use this DB environment variable to set the user and password to my Aurora database.
The problem is that I am getting this error:
ServerlessError: An error occurred: testLambdaFunction - Properties validation failed for resource testLambdaFunction with message:
#/Environment/Variables/DB: expected type: String, found: JSONObject.
at C:\Users\fer\AppData\Roaming\npm\node_modules\serverless\lib\plugins\aws\lib\monitorStack.js:94:23
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async AwsDeploy.update (C:\Users\fer\AppData\Roaming\npm\node_modules\serverless\lib\plugins\aws\lib\updateStack.js:144:5)
According to the Serverless docs, it should be working fine with getting a JSONObject.
What I am missing to make this work?
PS: Why should I add ~true at the end of the string to find the secret? If I remove this value i get the error:
A valid SSM parameter to satisfy the declaration 'ssm:/aws/reference/secretsmanager/qa/aurora' could not be found.
The problema was that i was nesting the 3 levels down the code:
DB: ${ssm:/aws/reference/secretsmanager/qa/aurora~true}
As soon as i change it to the same level of the environment attribute it worked

While connecting with ORM in Codeigniter getting a invalid Database error

[https://github.com/maltyxx/origami][1]
I am getting invalid database error while trying to use the ORM Composer from github .
The error is like :
You have specified an invalid database connection group (test) in your config/database.php file.
But in config/database.php i have given it clearly. Please help me on that.

Remote MongoDB access through Cloud 9 gives login failed exception

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.