Error With Rest Server: HyperLedger - rest

I am following the tutorial here:
https://hyperledger.github.io/composer/tutorials/queries.html#step-six-test-the-rest-apis-and-create-some-data
When I try to post the data,
I get the following response:
{
"error": {
"statusCode": 400,
"name": "SyntaxError",
"message": "Unexpected token \n in JSON at position 38",
"body": "{\n \"$class\": \"org.acme.biznet.Trader,\n \"tradeId\": \"TRADER1\",\n \"firstName\": \"Jenny\",\n \"lastName\": \"Jones\"\n}",
"status": 400,
"stack": "SyntaxError: Unexpected token \n in JSON at position 38\n at JSON.parse (<anonymous>)\n at parse (/usr/local/lib/node_modules/composer-rest-server/node_modules/body-parser/lib/types/json.js:88:17)\n at /usr/local/lib/node_modules/composer-rest-server/node_modules/body-parser/lib/read.js:116:18\n at invokeCallback (/usr/local/lib/node_modules/composer-rest-server/node_modules/raw-body/index.js:262:16)\n at done (/usr/local/lib/node_modules/composer-rest-server/node_modules/raw-body/index.js:251:7)\n at IncomingMessage.onEnd (/usr/local/lib/node_modules/composer-rest-server/node_modules/raw-body/index.js:307:7)\n at emitNone (events.js:105:13)\n at IncomingMessage.emit (events.js:207:7)\n at endReadableNT (_stream_readable.js:1059:12)\n at _combinedTickCallback (internal/process/next_tick.js:138:11)\n at process._tickCallback (internal/process/next_tick.js:180:9)"
}
}
I will appreciate any guidance on this, because as far as I can tell, I have followed the docs verbatim.

Looks like you're just missing the close quotes from org.acme.biznet.Trader in your input.

Related

Unable to upload my application to Meta Quest (App Lab)

I developed an app and wanted to upload it to the facebook Quest(App Lab) platform, but I tried many methods and failed to upload it
Here's what I've tried and failed
The upload button in the app is grayed out, and the MQDH cannot be uploaded
Using the drag and drop upload function of the latest version of MQDH, it prompts that the CLI tool does not exist or has no permission
Using the ovr-platform-util command line upload method, it prompts "An unexpected error occurred"
Here is the log content:
Server log: {
"app_id": 8618231871550973,
"client": "COMMAND_LINE",
"log_level": "ERROR",
"event_name": "UNEXPECTED_ERROR",
"stack_trace": "RangeError [ERR_OUT_OF_RANGE]: The value of \"offset\" is out of range. It must be >= 0 and <= 1. Received 2\n at new NodeError (node:internal/errors:371:5)\n at boundsError (node:internal/buffer:86:9)\n at Buffer.readUInt16LE (node:internal/buffer:243:5)\n at /snapshot/Users/facebook/.scratch/dataZsandcastleZboxesZeden-trunk-hg-full-fbsource/edenfsZredirectionsZarvrZjsZtemp/build-ovr-platform-util/lib/ovr_platform_util.js\n at Object.set extra [as extra] (/snapshot/Users/facebook/.scratch/dataZsandcastleZboxesZeden-trunk-hg-full-fbsource/edenfsZredirectionsZarvrZjsZtemp/build-ovr-platform-util/lib/ovr_platform_util.js)\n at p (/snapshot/Users/facebook/.scratch/dataZsandcastleZboxesZeden-trunk-hg-full-fbsource/edenfsZredirectionsZarvrZjsZtemp/build-ovr-platform-util/lib/ovr_platform_util.js)\n at Object.get entries [as entries] (/snapshot/Users/facebook/.scratch/dataZsandcastleZboxesZeden-trunk-hg-full-fbsource/edenfsZredirectionsZarvrZjsZtemp/build-ovr-platform-util/lib/ovr_platform_util.js)\n at Object.getEntries (/snapshot/Users/facebook/.scratch/dataZsandcastleZboxesZeden-trunk-hg-full-fbsource/edenfsZredirectionsZarvrZjsZtemp/build-ovr-platform-util/lib/ovr_platform_util.js)\n at /snapshot/Users/facebook/.scratch/dataZsandcastleZboxesZeden-trunk-hg-full-fbsource/edenfsZredirectionsZarvrZjsZtemp/build-ovr-platform-util/lib/ovr_platform_util.js\n at /snapshot/Users/facebook/.scratch/dataZsandcastleZboxesZeden-trunk-hg-full-fbsource/edenfsZredirectionsZarvrZjsZtemp/build-ovr-platform-util/lib/ovr_platform_util.js",
"extra": "{\"caught\":true,\"os\":\"{\\\"platform\\\":\\\"darwin\\\",\\\"arch\\\":\\\"x64\\\",\\\"type\\\":\\\"Darwin\\\"}\",\"cli_version\":\"1.81.0.000001\",\"compatibility_version\":2,\"session_id\":\"8618231871550973_2022-12-13T07:26:42.217Z\",\"command\":\"upload-quest-build\",\"app_id\":8618231871550973,\"platform\":\"ANDROID_6DOF\"}",
"platform": "ANDROID_6DOF",
"cli_version": "1.81.0.000001",
"session_id": "8618231871550973_2022-12-13T07:26:42.217Z",
"binary_id": ""
}
Server log: {
"app_id": 8618231871550973,
"client": "COMMAND_LINE",
"log_level": "DEBUG",
"event_name": "COMMAND_FAILED",
"stack_trace": "at Object._log (/snapshot/Users/facebook/.scratch/dataZsandcastleZboxesZeden-trunk-hg-full-fbsource/edenfsZredirectionsZarvrZjsZtemp/build-ovr-platform-util/lib/ovr_platform_util.js)\nat Object.debug (/snapshot/Users/facebook/.scratch/dataZsandcastleZboxesZeden-trunk-hg-full-fbsource/edenfsZredirectionsZarvrZjsZtemp/build-ovr-platform-util/lib/ovr_platform_util.js)\nat /snapshot/Users/facebook/.scratch/dataZsandcastleZboxesZeden-trunk-hg-full-fbsource/edenfsZredirectionsZarvrZjsZtemp/build-ovr-platform-util/lib/ovr_platform_util.js\nat processTicksAndRejections (node:internal/process/task_queues:96:5)",
"extra": "{\"code\":\"ERR_OUT_OF_RANGE\",\"os\":\"{\\\"platform\\\":\\\"darwin\\\",\\\"arch\\\":\\\"x64\\\",\\\"type\\\":\\\"Darwin\\\"}\",\"cli_version\":\"1.81.0.000001\",\"compatibility_version\":2,\"session_id\":\"8618231871550973_2022-12-13T07:26:42.217Z\",\"command\":\"upload-quest-build\",\"app_id\":8618231871550973,\"platform\":\"ANDROID_6DOF\"}",
"platform": "ANDROID_6DOF",
"cli_version": "1.81.0.000001",
"session_id": "8618231871550973_2022-12-13T07:26:42.217Z",
"binary_id": ""
}

Unable to reply to review in arabic ,using AGC Connect API

Got an error { ret: { rtnCode: 50010003, rtnDesc: 'param error' } }
Tried with lang as ar_AE as well as ara_AE.
This error code 50010003 will come when you will provide any incorrect parameters . Please identify and check it.
For details please refer to: https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-References/agcapi-comment-returncode-0000001116028252
POST https://connect-api.cloud.huawei.com/api/reviews/v1/manage/dev/reviews
Content-Type: application/json
client_id: ***
Authorization: Bearer ***
requestId: xxxxxxx
{
"lang": "ara_AE",
"appId": "300148173",
"reviewId": "9f43c56228854d66a65921938199c0ce",
"devReplyContent": "Reply content......",
"countryCode": "AE"
}
For Details , please refer to: https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-References/agcapi-com-reviewreply-0000001162548117

MongoDB Replica Set - The value of parameter linuxConfiguration.ssh.publicKeys.keyData is invalid

This is concerning the Azure Deployment Template for a MongoDB Replica Set defined here mongodb-replica-set-centos.
When I run the recommended deployment commands to deploy the replica set, namely
az group create --name <resource-group-name> --location <resource-group-location> # Use this command when you need to create a new resource group for your deployment.
az deployment group create --resource-group <my-resource-group> --template-uri https://raw.githubusercontent.com/migr8/AzureDeploymentTemplates/main/mongo/mongodb-replica-set-centos/azuredeploy.json
where the resource group is already set up. I receive the following error:
{
"status": "Failed",
"error": {
"code": "DeploymentFailed",
"message": "At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details.",
"details": [
{
"code": "Conflict",
"message": "{\r\n \"status\": \"Failed\",\r\n \"error\": {\r\n \"code\": \"ResourceDeploymentFailure\",\r\n \"message\": \"The resource operation completed with terminal provisioning state 'Failed'.\",\r\n \"details\": [\r\n {\r\n \"code\": \"DeploymentFailed\",\r\n \"message\": \"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details.\",\r\n \"details\": [\r\n {\r\n \"code\": \"BadRequest\",\r\n \"message\": \"{\\r\\n \\\"error\\\": {\\r\\n \\\"code\\\": \\\"InvalidParameter\\\",\\r\\n \\\"message\\\": \\\"The value of parameter linuxConfiguration.ssh.publicKeys.keyData is invalid.\\\",\\r\\n \\\"target\\\": \\\"linuxConfiguration.ssh.publicKeys.keyData\\\"\\r\\n }\\r\\n}\"\r\n }\r\n ]\r\n }\r\n ]\r\n }\r\n}"
},
{
"code": "Conflict",
"message": "{\r\n \"status\": \"Failed\",\r\n \"error\": {\r\n \"code\": \"ResourceDeploymentFailure\",\r\n \"message\": \"The resource operation completed with terminal provisioning state 'Failed'.\",\r\n \"details\": [\r\n {\r\n \"code\": \"DeploymentFailed\",\r\n \"message\": \"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details.\",\r\n \"details\": [\r\n {\r\n \"code\": \"BadRequest\",\r\n \"message\": \"{\\r\\n \\\"error\\\": {\\r\\n \\\"code\\\": \\\"InvalidParameter\\\",\\r\\n \\\"message\\\": \\\"The value of parameter linuxConfiguration.ssh.publicKeys.keyData is invalid.\\\",\\r\\n \\\"target\\\": \\\"linuxConfiguration.ssh.publicKeys.keyData\\\"\\r\\n }\\r\\n}\"\r\n }\r\n ]\r\n }\r\n ]\r\n }\r\n}"
}
]
}
}
The problem field is in both primary-resources.json and secondary-resources.json appears to be
"variables": {
"subnetRef": "[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('subnet').vnet, parameters('subnet').name)]",
"securityGroupName": "[concat(parameters('namespace'), parameters('vmbasename'), 'nsg')]",
"linuxConfiguration": {
"disablePasswordAuthentication": true,
"ssh": {
"publicKeys": [
{
"path": "[concat('/home/', parameters('adminUsername'), '/.ssh/authorized_keys')]",
"keyData": "[parameters('adminPasswordOrKey')]"
}
]
}
}
},
And ascociated with the variable adminPasswordOrKey. I have tried changing this to be both standard passwords and SSH keys of varying bit-depth, no luck...
How can I fix this?
Repro steps
Run az group create --name <resource-group-name> --location <resource-group-location> where resource group exists.
Run az deployment group create --resource-group <my-resource-group> --template-uri https://raw.githubusercontent.com/migr8/AzureDeploymentTemplates/main/mongo/mongodb-replica-set-centos/azuredeploy.json and step through the prompts
Enter the relevant in formation.
Further Investigation
I have just seen this answer (https://stackoverflow.com/a/60860498/626442) saying specifically that
Note: Please note that the only allowed path is /home//.ssh/authorized_keys due to a limitation of Azure.
I have changed this value of the path, no joy, same error. :'[
You forgot to pass parameters in az deployment group create .... --parameters azuredeploy.parameters.json. You can download azuredeploy.parameters.json and change values as needed. See https://learn.microsoft.com/en-us/azure/azure-resource-manager/templates/template-tutorial-use-parameter-file?tabs=azure-cli#deploy-template for details.
Specifically the error in the question complains about adminUsername parameter being empty. Bear in mind this user name is also being used in the home directory path, so limit yourself to lowcase ASCII a-z, numbers, underscore. No spaces, not special characters, no utf.
Not related to the error, but be aware these necromancers use mongo 3.2 which was buried 4 years ago: https://www.mongodb.com/support-policy/lifecycles. Considering they open it wide to the internet you may have way more problems if you actually deploy it.
UPDATE
An example of the parameters I used:
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"adminUsername": {
"value": "yellow"
},
"mongoAdminUsername": {
"value": "phrase"
},
"mongoAdminPassword": {
"value": "settle#SING"
},
"secondaryNodeCount": {
"value": 2
},
"sizeOfDataDiskInGB": {
"value": 2
},
"dnsNamePrefix": {
"value": "written"
},
"centOsVersion": {
"value": "7.7"
},
"primaryNodeVmSize": {
"value": "Standard_D1_v2"
},
"secondaryNodeVmSize": {
"value": "Standard_D1_v2"
},
"zabbixServerIPAddress": {
"value": "Null"
},
"adminPasswordOrKey": {
"value": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDdNRTU0XF3xazhhDmwXXWGG7wp4AaQC1r89K7sZFRXp9VSUtydV59DHr67mV5/0DWI5Co1yWK713QJ00BPlBIHNMNLuoBBq8IkOx8fBZF1g9YFm5Zy4ay+CF4WgDITAsyxhKvUWL6jwG5M3XIdVYm49K+EFOCWSSaNtCk8tHhi3v6/5HFkwc2r0UL/WWWbbt5AmpJ8QOCDk/x+XcgCjP9vE5jYYGsFz9F6V1FdOpjVfDwi13Ibivj/w2wOZh2lQGskC+qDjd2upK13+RfWYHY3rr+ulNRPckHRhOqmZ2vlUapO4T0X9mM6ugSh1FprLP5nHdVCUls2yw4BAcSoM9NMiyafE56Xkp9h3bTAfx5Ufpe5mjwQp+j15np1pVpwDaEgk7ZeaPoZPhbalpvZGyg9KiKfs9+KUYHfGklIOHKJ3RUoPE286rg1U4LGswil5RARRSf86kBBHXaIPxy1X0N6QryeWhk0aM6LWEdl7mVbQksa7ilANnsaVMl7FSdY/Cc="
}
}
}
DANGER: It will deploy publicly accessible mongodb replica set with publicly accessible credentials, so please delete the resources as soon as you are happy with testing/debugging
This is how deployment looks like on the portal:

PermissionDeniedError: From /job:worker/replica:0/task:0

I am using google colaboratory to pretrain bert.My train_data is on google cloud storage,my code is on colab
IS_COLAB_BACKEND = 'COLAB_GPU' in os.environ
if IS_COLAB_BACKEND:
from google.colab import auth
auth.authenticate_user()
model_saved_path = 'gs://zhongxing_train/model/roberta_pretrain_model2.ckpt'
corpus_paths = ['gs://zhongxing_train/corpus.0.tfrecord' ]
tpu_address = 'grpc://' + os.environ['COLAB_TPU_ADDR']
The flowing is error message:
PermissionDeniedError Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py in _do_call(self, fn, *args)
1355 try:
-> 1356 return fn(*args)
1357 except errors.OpError as e:
10 frames
PermissionDeniedError: From /job:worker/replica:0/task:0:
Error executing an HTTP request: HTTP response code 403 with body '{
"error": {
"code": 403,
"message": "service-555555555555#cloud-tpu.iam.gserviceaccount.com does not have storage.objects.get access to zhongxing_train/corpus.0.tfrecord.",
"errors": [
{
"message": "service-555555555555#cloud-tpu.iam.gserviceaccount.com does not have storage.objects.get access to zhongxing_train/corpus.0.tfrecord.",
"domain": "global",
"reason": "forbidden"
}
]
}
}
'
when reading metadata of gs://zhongxing_train/corpus.0.tfrecord
[[{{node MultiDeviceIteratorGetNextFromShard}}]]
[[RemoteCall]]
[[IteratorGetNextAsOptional]]
During handling of the above exception, another exception occurred:
PermissionDeniedError Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py in _do_call(self, fn, *args)
1368 pass
1369 message = error_interpolation.interpolate(message, self._graph)
-> 1370 raise type(e)(node_def, op, message)
1371
1372 def _extend_graph(self):
PermissionDeniedError: From /job:worker/replica:0/task:0:
Error executing an HTTP request: HTTP response code 403 with body '{
"error": {
"code": 403,
"message": "service-555555555555#cloud-tpu.iam.gserviceaccount.com does not have storage.objects.get access to zhongxing_train/corpus.0.tfrecord.",
"errors": [
{
"message": "service-555555555555#cloud-tpu.iam.gserviceaccount.com does not have storage.objects.get access to zhongxing_train/corpus.0.tfrecord.",
"domain": "global",
"reason": "forbidden"
}
]
}
}
'
when reading metadata of gs://zhongxing_train/corpus.0.tfrecord
[[{{node MultiDeviceIteratorGetNextFromShard}}]]
[[RemoteCall]]
[[IteratorGetNextAsOptional]]
This is my colab cord
I think maybe I need to set permission for my train_data on cloud storage
How can I get permission from google cloud storage
You need to grant your service account with storage.objects.get permission, which you can do by granting the service account with at least the Storage Object Viewer role.
You can do it using the Cloud Console or the Cloud SDK.

Google Cloud Functions GitHub auto-deployer says: The request has errors

I have installed the GitHub auto-deployer for Google Cloud Functions, but when I now push my function into my GitHub repository, I receive an abstract error message "The request has errors" with the following rather non-descript details. What could specifically be going wrong here?
E githubAutoDeployer [CODE] 2017-12-30 19:19:37.362
Failed to create function projects/[MY_BUCKET]/locations/us-central/functions/[MY_FUNCTION] { Error: The request has errors
at Request._callback (/user_code/node_modules/googleapis/node_modules/google-auth-library/lib/transporters.js:85:15)
at Request.self.callback (/user_code/node_modules/googleapis/node_modules/request/request.js:186:22)
at emitTwo (events.js:106:13)
at Request.emit (events.js:191:7)
at Request.<anonymous> (/user_code/node_modules/googleapis/node_modules/request/request.js:1163:10)
at emitOne (events.js:96:13)
at Request.emit (events.js:188:7)
at IncomingMessage.<anonymous> (/user_code/node_modules/googleapis/node_modules/request/request.js:1085:12)
at IncomingMessage.g (events.js:292:16)
at emitNone (events.js:91:20)
code: 400,
errors:
[ { message: 'The request has errors',
domain: 'global',
reason: 'badRequest' } ] }
E githubAutoDeployer [CODE] 2017-12-30 19:19:37.363 Error: The request has errors
at Request._callback (/user_code/node_modules/googleapis/node_modules/google-auth-library/lib/transporters.js:85:15)
at Request.self.callback (/user_code/node_modules/googleapis/node_modules/request/request.js:186:22)
at emitTwo (events.js:106:13)
at Request.emit (events.js:191:7)
at Request.<anonymous> (/user_code/node_modules/googleapis/node_modules/request/request.js:1163:10)
at emitOne (events.js:96:13)
at Request.emit (events.js:188:7)
at IncomingMessage.<anonymous> (/user_code/node_modules/googleapis/node_modules/request/request.js:1085:12)
at IncomingMessage.g (events.js:292:16)
at emitNone (events.js:91:20)
D githubAutoDeployer [CODE] 2017-12-30 19:19:37.365
Function execution took 2319 ms, finished with status code: 500
UPDATE The mentioning of google-auth-library in the stack trace made me think that something may be wrong with my credentials. But the output from gcloud auth list appears alright:
Credentialed Accounts
ACTIVE ACCOUNT
* [MY_ID]#gmail.com
UPDATE What is perhaps slightly unconventional is that I have "path":"", in my config.json. But then my index.js resides directly at the top of my repository, so there is no path to specify.
UPDATE This is where the error from Google Cloud Functions is passed on by githubAutoDeployer (unfortunately source code for the upstream server is apparently not available):
gcf.projects.locations.functions.create({ resource, location }, (err, operation) => {
if (err && err.errors && err.errors[0] && err.errors[0].reason === 'alreadyExists') {
// ...
} else if (err) {
console.error(`Failed to create function ${resource.name}`, err);
reject(err);
}
The trouble was that I was specifying "location" : "us-central" instead of us-central1 (which supports Google Cloud Functions) in my config.json.
I found out by sending a raw POST request to the Google Cloud Functions API (after obtaining a service account and access token, etc.). At this level the API returns a clear error indication:
"fieldViolations": [
{
"field": "region",
"description": "region us-central is not supported."
}
]
Apparently and unfortunately this does not enter any of the log files when githubAutoDeployer attempts the same call.