Why there is a different result of graphQL query? - graphql

I have created a hello world application to reproduce a issue (source: https://gist.github.com/piotrkonieczny/f9f2659799a384ec2e4f9fc18eed5364). The problem is that if I query two identical objects I receive different results.
Output from Ubuntu 20.04.1 (WSL2) and Windows 10 is the same:
npm start
> graphql_playground#1.0.0 start
> node index.js
{"hello":"Hello world!"} { hello: 'Hello world!' }
{"hello":"Hello world!"} { hello: 'Hello world!' }
[Object: null prototype] { hello: null }
[Object: null prototype] { hello: 'Hello world!' }
Env:
$ node -v
v16.17.1
$ npm -v
8.15.0
Any ideas? :)

Related

Permission denied error while running Cypress UI automation scripts with Jenkins in docker linux containers

We have a UI automation script created using Cypress/JavaScript. Scripts run perfectly fine on the local machine. We created a Jenkins job and are trying to run scripts in linux docker container. Pls see below Jenkinsfile for same.
#Library('jenkins-shared-libraries#v2') _
pipeline {
agent {
kubernetes {
yaml podYamlLinux(
customContainerYamls: [
'''
- name: nodeimg
image: node
options: --user 1001
imagePullPolicy: Always
resources:
requests:
memory: "100Mi"
cpu: "100m"
limits:
memory: "1Gi"
cpu: "500m"
tty: true
command:
- cat
securityContext:
privileged: true
'''
]
)
}}
stages {
// Install and verify Cypress
stage('installation') {
steps {
container('nodeimg') {
sh 'npm i'
sh 'npm install cypress --save-dev'
}
}
}
stage('Cypress Test') {
steps {
echo "Running Tests"
container('nodeimg') {
sh 'npm run cypressVerify'
}
}
}
}
post {
// shutdown the server running in the background
always {
echo 'Stopping local server'
publishHTML([allowMissing: false, alwaysLinkToLastBuild: false, keepAll: true,
reportDir: 'cypress/report', reportFiles: 'index.html', reportName: 'HTML
Report', reportTitles: ''])
}
}
}
I have attached pic of package.json file as well.
I have tried different configurations to resolve this but currently getting error message "/tmp/cypressVerify-b91242e3.sh: 1: cypress: Permission denied script returned exit code 126".
It would be great if community help me resolve this.

report folder does not exist error with htmlpublisher

I am trying to write a jenkins pipeline script for one of my playwright test. Below is one simple code which i have done so far.
pipeline {
agent any
stages {
stage('Run Playwright Test') {
steps {
runTest()
}
}
stage('Publish Report'){
steps {
script {
sh 'ls -lrta'
//print REPORT_FILES
}
publishHTML([
allowMissing: false,
alwaysLinkToLastBuild: true,
keepAll: true,
//reportDir: '.',
reportDir : "./TestReport2",
reportFiles: 'index.html',
reportName: "Html Reports",
reportTitles: 'Report title'
])
}
}
}
}
def runTest() {
node('MYNODE') {
docker.image('image details').inside('--user root'){
git branch: 'mybranchName',credentialsId: 'ID, url: 'url'
catchError() {
sh """
cd WebTests
npm install
npx playwright test --project=CHROME_TEST --grep #hello
"""
}
sh "cp -R WebTests/TestReport TestReport2"
sh 'cd TestReport2; ls -lrta'
}
When I use the above code, the test executed successfully however i am seeing an error while trying to publish the report.
Below is the error :
Specified HTML directory '/bld/workspace//TestReport2' does not exist.
observation: when i put a ls -ltr after the runTest code i could not see the TestReport2 folder even if it was copied successfully.
Another thing i tried is when i put the code to publish the HTML as part of the runTest() it worked fine and i am able to see the reports generated. Something is going on with the TestReport2 folder when the block of code for runTest() is completed.
Does anyone have an eye on what is the root cause. Any suggestion will be appreciated

How can I query an internally deployed API from my Jelastic environment?

I am writing a Jelastic manifest where I deploy two nodes. On one node, I have an API that I need to query in order to setup the second. Something along these lines:
type: install
name: My test
nodes:
- count: 1
cloudlets: 4
nodeGroup: auth
nodeType: docker
image: my-api:latest
- count: 1
cloudlets: 16
nodeGroup: cp
nodeType: docker
image: some-service:latest
onInstall:
- script: |
import com.hivext.api.core.utils.Transport;
try {
const body = new Transport().get("http://${nodes.auth.master.intIP}:9011/api/key", {
"Authorization": "my-api-key"
});
return { result: 0, body: body };
} catch (e) {
return {
type: "error",
message: "unknown error: " + e
};
}
In my script, when I do
const body = new Transport().get("http://www.google.com");
it works, I get the body content of the google page. However,
const body = new Transport().get("http://${nodes.auth.master.intIP}:9011/api/key", {
"Authorization": "my-api-key"
});
returns
ERROR: script.response: {"type":"error","message":"unknown error: JavaException: java.io.IOException: Failed to select a proxy"}
What am I doing wrong? How can I query my service in a script like in the above snippet? When I curl it through regular cmd, then it works:
curl -s -H "Authorization: my-api-key" http://${nodes.auth.master.intIP}:9011/api/key
Also, incidentally, where can I find the documentation of com.hivext.api.core.utils.Transport?
You can't access your environment node via internal IP from the script (at least it's not guaranteed).
As a workaround, you can access your node via public IP or endpoint.
If public IP or endpoint is not applicable in your case and your service must be accessed only internally, you can try to access your node via curl and ExecCmd API. For example:
type: install
name: My test
nodes:
- count: 1
cloudlets: 4
nodeGroup: auth
nodeType: docker
image: my-api:latest
- count: 1
cloudlets: 16
nodeGroup: cp
nodeType: docker
image: some-service:latest
onInstall:
- script: |
function execInternalApi(nodeId, url) {
let resp = api.env.control.ExecCmdById({
envName: '${env.name}',
nodeId: nodeId,
commandList: toJSON([{
command: 'curl -fSsl -H "Authorization: my-api-key" \'' + url + '\''
}])
})
if (resp.result != 0) return resp
return { result: 0, out: resp.responses[0].out }
}
let body = execInternalApi(${nodes.auth.master.id}, 'http://localhost:9011/api/key');
return { result: 0, body: body };

build-spec Error parsing spec file: expected value at line 1 column 1

I am following the Substrate Developer Hub tutorial in here: https://substrate.dev/docs/en/tutorials/start-a-private-network/customspec
I have successfully executed the command:
./target/release/node-template build-spec --disable-default-bootnode --chain local > customSpec.json
But when I try to parse this last file using this command:
./target/release/node-template build-spec --chain=customSpec.json --raw --disable-default-bootnode > customSpecRaw.json
I got the following error:
Error: Input("Error parsing spec file: expected value at line 1 column 1")
The contents of the customSpec.json are:
{
"name": "Local Testnet",
"id": "local_testnet",
"chainType": "Local",
"bootNodes": [],
"telemetryEndpoints": null,
"protocolId": null,
"properties": null,
"consensusEngine": null,
"lightSyncState": null,
"genesis": {
"runtime": {
"frameSystem":
...
...
"palletSudo": {
"key": "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY"
}
}
}
}
I am attempting the Hello World Hackathon by Polkadot.
Thank you in advance.
I was having this problem on when I was building the chain spec using Windows Powershell. But I used the regular Windows Console and it worked fine.

PARSE DASHBOARD unable to see cloud logs after upgrading dashboard

After updating my parse-dashboard i lost the "logs column" as you can see:
I just upgraded my parse-dashboard and my parse server:
dashboard: ?.?.? (package.json https://pastebin.com/KRFaxJha)
parse-server: 2.4.0
node: 7.10.0
This is my parse-dashboard configuration file:
{
"apps": [
{
"appId": "APP_ID",
"masterKey": "MASTER_KEY",
"restKey": "REST_KEY",
"serverURL": "http://WWW_WEBSITE:8081/parse",
"appName":"APP_NAME"
}
],
"users": [
{
"user": "ADMIN",
"pass": "ADMINXXXXXXX"
}
]
}
This is my cloud code test function:
Parse.Cloud.define("hello", function(request, response) {
response.success("Hello world!");
});
When i call it with a curl i have:
curl -X POST -H "X-Parse-Application-Id: APP_ID" -H "X-Parse-REST-API-Key: REST_KEY" -H "Content-Type: application/json" -d '{ }' http://WWW_WEBSITE:8081/parse/functions/hello
{"result":"Hello world!"}
the result is correct and on the parse server i have the trace:
verbose: REQUEST for [POST] /parse/functions/hello: {} method=POST, url=/parse/functions/hello, user-agent=curl/7.29.0, host=WWW_WEBSITE:8081, accept=*/*, x-parse-application-id=APPID, x-parse-rest-api-key=REST_KEY, content-type=application/json, content-length=3,
info: Ran cloud function hello for user undefined with:
Input: {}
Result: "Hello world!" functionName=hello, , user=undefined
verbose: RESPONSE from [POST] /parse/functions/hello: {
"response": {
"result": "Hello world!"
}
} result=Hello world!
I have seen this topic:
https://github.com/parse-community/parse-dashboard/issues/281
and i have try to set the verbose export variable on my parse-server and dashboard
i think i have miss some configuration but i can't find which one,
Thanks a lot,
Canna
Bad dashboard version i don't know why:
npm install -g parse-dashboard fix it and installed the good dashboard version

Resources