Bad Request Error encountered with GraphQL DotNet - asp.net-core

I'm using GraphQL.Net and getting the following when trying to use the API.
{
"version": {
"major": 1,
"minor": 1,
"build": -1,
"revision": -1,
"majorRevision": -1,
"minorRevision": -1
},
"content": {
"headers": [
{
"key": "Content-Type",
"value": [
"application\/json; charset=utf-8"
]
}
]
},
"statusCode": 400,
"reasonPhrase": "Bad Request",
"headers": [
],
"requestMessage": {
"version": {
"major": 2,
"minor": 0,
"build": -1,
"revision": -1,
"majorRevision": -1,
"minorRevision": -1
},
"content": null,
"method": {
"method": "GET"
},
"requestUri": null,
"headers": [
],
"properties": {
}
},
"isSuccessStatusCode": false
}
It is quite vague as to what the cause of the error is. Is there something wrong with the setup of my queries / types? Or is it in my request? Is it about authentication?
I'm not sure which code to share, so I uploaded my API library at: https://github.com/jonasarcangel/GraphQLIssue
Request payload is as follows (using Apollo Angular):
{
"operationName": "configsQuery",
"variables": {
"id": "",
"module": "admin\/configs",
"name": "canActivate"
},
"query": "query configsQuery($id: String, $module: String, $name: String) {\n configs(id: $id, module: $module, name: $name) {\n id\n createdBy\n createdDate\n updatedBy\n updatedDate\n name\n module\n value\n __typename\n }\n}\n"
}

Related

Nuxt Auth Custom Scheme with local strategies using Bearer Authorization

I want to make a custom scheme with local strategies but I don't know how can I do it using customScheme. Documentation of nuxt/auth v5 doest not help me
I want to execute two endpoint:
1st- request
POST /oauth/v2/token
HEAD:
Content-Type: application/x-www-form-urlencoded
body of the request:
clientId : string
clientSecret: string
grantType: string
username: string
password: string
response:
{
"accessToken": "string",
"expireTime": "2022-01-10T20:29:10.721Z",
"refreshToken": "string"
}
2nd- request
GET /security/users/me
HEAD
x-locale: fr|en
authorization: Bearer <TOKEN>
response:
{
"username": "string",
"firstname": "string",
"lastname": "string",
"email": "string",
"phone": "string",
"locale": "fr",
"id": 1,
"enabled": true,
"createdAt": "2022-01-10T20:38:36.478Z",
"updatedAt": "2022-01-10T20:38:36.478Z",
"expiresAt": "2022-01-10T20:38:36.478Z",
"loggedAt": "2022-01-10T20:38:36.478Z",
"roles": [
{
"name": "string",
"description": "string",
"code": "string",
"id": 1,
"enabled": true,
"createdAt": "2022-01-10T20:38:36.478Z",
"updatedAt": "2022-01-10T20:38:36.478Z",
"translations": {
"fr": {
"name": "string",
"description": "string"
},
"en": {
"name": "string",
"description": "string"
}
},
"permissions": [
{
"id": 1,
"code": "string",
"endUI": {
"name": "string",
"title": "string",
"id": 1,
"code": "string",
"type": {
"name": "string",
"code": "string",
"id": 1,
"enabled": true,
"createdAt": "2022-01-10T20:38:36.478Z",
"updatedAt": "2022-01-10T20:38:36.478Z",
"translations": {
"fr": {
"name": "string"
},
"en": {
"name": "string"
}
}
},
"module": {
"name": "string",
"description": "string",
"code": "string",
"id": 1,
"enabled": true,
"createdAt": "2022-01-10T20:38:36.478Z",
"updatedAt": "2022-01-10T20:38:36.478Z",
"translations": {
"fr": {
"name": "string",
"description": "string"
},
"en": {
"name": "string",
"description": "string"
}
}
},
"icon": "string",
"uri": "string",
"translations": {
"fr": {
"name": "string",
"title": "string"
},
"en": {
"name": "string",
"title": "string"
}
}
}
}
]
}
],
"avatar": {
"id": 1,
"url": "string"
}
}
nuxt.config.js
modules: [
// https://go.nuxtjs.dev/axios
'#nuxtjs/axios',
// https://go.nuxtjs.dev/pwa
'#nuxtjs/pwa',
'#nuxtjs/auth-next',
'#nuxtjs/dotenv',
'#nuxtjs/i18n', [
'nuxt-vuex-localstorage',
{
mode: 'debug',
localStorage: [
'user',
'service',
'location',
'storeType',
'warehouse',
'openingRange',
'store',
'holiday',
'taxon',
'provider',
'productOption',
'productAttribute',
'product',
'productVariant',
'glassesCatalog'
],
},
],
],
router: {
middleware: ['auth']
},
// Auth Strategies
auth: {
strategies: {
customStrategy: {
_scheme: '~/schemes/customScheme',
endpoints: {
login: {
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
url: '/oauth/v2/token',
method: 'post'
},
user: {
url: '/security/users/me',
method: 'get',
propertyName: '',
headers: {
'x-locale': 'fr',
'Authorization': `Bearer ${It should be a token (accessToken) for the first request}`
}
}
}
}
}
}
~/schemes/customeScheme.js
import { LocalScheme } from '~auth/runtime'
export default class CustomScheme extends LocalScheme {
// Override `fetchUser` method of `local` scheme
async fetchUser (endpoint) {
// Token is required but not available
if (!this.check().valid) {
return
}
// User endpoint is disabled.
if (!this.options.endpoints.user) {
this.$auth.setUser({})
return
}
// Try to fetch user and then set
return this.$auth.requestWith(
this.name,
endpoint,
this.options.endpoints.user
).then((response) => {
const user = getProp(response.data, this.options.user.property)
// Transform the user object
const customUser = {
...user,
fullName: user.firstName + ' ' + user.lastName,
roles: ['user']
}
// Set the custom user
// The `customUser` object will be accessible through `this.$auth.user`
// Like `this.$auth.user.fullName` or `this.$auth.user.roles`
this.$auth.setUser(customUser)
return response
}).catch((error) => {
this.$auth.callOnError(error, { method: 'fetchUser' })
})
}
}
~/login.vue
onSubmit(){
this.isSubmitting = true;
this.isDisabled= true;
let formData = new FormData();
formData.append("clientId", process.env.CLIENT_ID);
formData.append("clientSecret", process.env.CLIENT_SECRET);
formData.append("grantType", "password");
formData.append("username", this.dataUser.username);
formData.append("password", this.dataUser.password);
this.$refs.dataUser.validate(async (valid, fieldsError) => {
this.validate = valid;
if(valid){
try {
let response = await this.$auth.loginWith('customStrategy', { data: formData })
console.log(response);
this.$store.dispatch('storeSecurity/storeUserToken', response.data);
} catch (error) {
this.$message.error({content: this.$t("login.error"), key, duration: 3});
}
}
});
},
If I want to fetch user, how can i do please ???
everything I do gives me errors that have no answers in the doc
I need help please
You should use $auth.setUser(user) to set the current user after successfully login. That is iif your endpoints.user doesn't work.

Azure DevOps API release definition error

I am creating azure-devops release pipeline with API, but getting error. I have validated the json as well and is correct from https://jsonlint.com/ Any help would be really appreciated
I have followed this issue as well and retention policy is correctly passed
Azure DevOps API release definition
error: "message": "VS402982: A retention policy is not set for the stage ‘Test-New-2’. Retention policies at the release pipeline level are deprecated. Use a retention policy at the stage level
POST https://vsrm.dev.azure.com/{{organization}}/{{project}}/_apis/release/definitions?api-version=6.0
json body:
"retentionPolicy": {
"daysToKeep": 30,
"releasesToKeep": 3,
"retainBuild": true
},
Yes, it should be the syntax issue, to create a release definition, you could refer to this sample.
Reruest URL:
POST https://vsrm.dev.azure.com/{organization}/{project}/_apis/release/definitions?api-version=6.0
Request Body:
{
"source": "undefined",
"revision": 1,
"description": null,
"createdBy": null,
"createdOn": "0001-01-01T00:00:00",
"modifiedBy": null,
"modifiedOn": "0001-01-01T00:00:00",
"isDeleted": false,
"variables": {},
"variableGroups": [],
"environments": [
{
"id": 0,
"name": "PROD",
"variables": {},
"variableGroups": [],
"preDeployApprovals": {
"approvals": [
{
"rank": 1,
"isAutomated": false,
"isNotificationOn": false,
"approver": {
"displayName": null,
"id": "aeb95c63-4fac-4948-84ce-711b0a9dda97"
},
"id": 0
}
]
},
"postDeployApprovals": {
"approvals": [
{
"rank": 1,
"isAutomated": true,
"isNotificationOn": false,
"id": 0
}
]
},
"deployPhases": [
{
"deploymentInput": {
"parallelExecution": {
"parallelExecutionType": "none"
},
"skipArtifactsDownload": false,
"artifactsDownloadInput": {},
"queueId": 15,
"demands": [],
"enableAccessToken": false,
"timeoutInMinutes": 0,
"jobCancelTimeoutInMinutes": 1,
"condition": "succeeded()",
"overrideInputs": {}
},
"rank": 1,
"phaseType": "agentBasedDeployment",
"name": "Run on agent",
"workflowTasks": []
}
],
"environmentOptions": {
"emailNotificationType": "OnlyOnFailure",
"emailRecipients": "release.environment.owner;release.creator",
"skipArtifactsDownload": false,
"timeoutInMinutes": 0,
"enableAccessToken": false,
"publishDeploymentStatus": false,
"badgeEnabled": false,
"autoLinkWorkItems": false,
"pullRequestDeploymentEnabled": false
},
"demands": [],
"conditions": [],
"executionPolicy": {
"concurrencyCount": 0,
"queueDepthCount": 0
},
"schedules": [],
"retentionPolicy": {
"daysToKeep": 30,
"releasesToKeep": 3,
"retainBuild": true
},
"properties": {},
"preDeploymentGates": {
"id": 0,
"gatesOptions": null,
"gates": []
},
"postDeploymentGates": {
"id": 0,
"gatesOptions": null,
"gates": []
},
"environmentTriggers": []
}
],
"artifacts": [],
"triggers": [],
"releaseNameFormat": null,
"tags": [],
"properties": {},
"id": 0,
"name": "Fabrikam-web",
"projectReference": null,
"_links": {}
}
I test it on my side, it works for me.

Can't get button's link from message using Gmail API

I am trying to get button's link from message of gmail (ex. verify account button). Is there any way to make it via Google API?
I used Api to get all messages first: https://www.googleapis.com/gmail/v1/users/me/messages
Then used this api to get the message details: https://www.googleapis.com/gmail/v1/users/me/messages/{message_id}
but can't find the link inside the email body, here is the response!!
{
"id": "1785a64978e454be",
"threadId": "1785a528dc1e905c",
"labelIds": [
"IMPORTANT",
"CATEGORY_PERSONAL",
"INBOX"
],
"snippet": "Invesna Logo Hello Turki Thank you for joining our community Best wishes INVESNA Team Verify Now This is an automated email. If you've received this email by mistake, please",
"payload": {
"partId": "",
"mimeType": "multipart/alternative",
"filename": "",
"headers": [
{
"name": "Delivered-To",
"value": "areeb.*****#gmail.com"
},
{
"name": "Received",
"value": "by 2002:a6b:916:0:0:0:0:0 with SMTP id t22csp3887526ioi; Mon, 22 Mar 2021 07:44:05 -0700 (PDT)"
},
{
"name": "X-Google-Smtp-Source",
"value": "ABdhPJyvgEKiYNby+5oLp9d6ZLU4ujfWHmppkGFvw2POAHup5hfkbaexaDRj9bwjk1zLmhyuIfsq"
},
{
"name": "X-Received",
"value": "by 2002:ac8:4752:: with SMTP id k18mr234477qtp.158.1616424245098; Mon, 22 Mar 2021 07:44:05 -0700 (PDT)"
},
{
"name": "ARC-Seal",
"value": "i=1; a=rsa-sha256; t=1616424245; cv=none; d=google.com; s=arc-20160816; b=cTBJJWs+fBO2mU4nAKoz+VzfvNI7RrAW3PKApijZ0LI4v6Ma1XAQxKilc+IEiwcmFE D6cTkU9CVAS9f+IOaE3bb8NCnQVz7mFvFkD72vvDeWaMsW2V2jbKZoFPdFKDGZ6b70fq WUXxy5uCHkafF9gAtmPFU2eTfMRRk5uv3ZA8XGcO87JWSYngzz/DoOdD6cQOVfIiv4HF YGAITJGHTYL2kgwdRVlSJCKQBpQZIJqM3pUHaYJ3+uXs2rg1XkaLyFudF3brG7tKUOMN gCXsyINhAfuTw2bIrWmSX+8B3AHG+h+aQfTbl9GNr3oBLYYM7BRMSfG2S8jldm6XnEpM ZUEg=="
},
{
"name": "ARC-Message-Signature",
"value": "i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=feedback-id:mime-version:to:from:subject:date:message-id :dkim-signature:dkim-signature; bh=RToLBuWpZqa2f+3AtVt2tvS0pNeSTnAA4DQnGQ8mMWU=; b=prTkhBY/VOg77E8LDGE3HZD7rGb2vQuG2uln53Jh3ee4fXIKZtB6RwVUjBrodFyb6S FXUbY0Iox/TWv+Maqr0p89waYhGYy/aQD4g6G3/8BwLSCqAOc65JsKMGwGor/t2ZdsOZ w97c2w3eswYEfu9FuhXyCLV9Jbg/4bw32JWb59mKuAQSKx6aeiipXShmPmAmI5FWxlmu y/dbft5H4weUd3jXQjbAqXnfzyEso+nbl2iexfobZ4vqRPzarwk9tSZEC73mgqbsA5ZF zx9xPOYxJbMVin5Wrsit0p8xVv3DD1UlPGqNCItAviqUkHqtUDkznPmiWpFXtXLxoyk2 3SyA=="
},
{
"name": "ARC-Authentication-Results",
"value": "i=1; mx.google.com; dkim=pass header.i=#areebgroup.com header.s=ly5fxy3f4dncdbipp3gron65eulkyt3p header.b=XztlZ3Jb; dkim=pass header.i=#amazonses.com header.s=ug7nbtf4gccmlpwj322ax3p6ow6yfsug header.b=FtocR6ro; spf=pass (google.com: domain of 010001785a649518-d06bf9df-a011-4cee-81ed-9328a70eaa39-000000#amazonses.com designates 54.240.48.108 as permitted sender) smtp.mailfrom=010001785a649518-d06bf9df-a011-4cee-81ed-9328a70eaa39-000000#amazonses.com"
},
{
"name": "Return-Path",
"value": "<010001785a649518-d06bf9df-a011-4cee-81ed-9328a70eaa39-000000#amazonses.com>"
},
{
"name": "Received",
"value": "from a48-108.smtp-out.amazonses.com (a48-108.smtp-out.amazonses.com. [54.240.48.108]) by mx.google.com with ESMTPS id cj6si7995790qvb.74.2021.03.22.07.44.04 for <areeb.testing2#gmail.com> (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-SHA bits=128/128); Mon, 22 Mar 2021 07:44:05 -0700 (PDT)"
},
{
"name": "Received-SPF",
"value": "pass (google.com: domain of 010001785a649518-d06bf9df-a011-4cee-81ed-9328a70eaa39-000000#amazonses.com designates 54.240.48.108 as permitted sender) client-ip=54.240.48.108;"
},
{
"name": "Authentication-Results",
"value": "mx.google.com; dkim=pass header.i=#areebgroup.com header.s=ly5fxy3f4dncdbipp3gron65eulkyt3p header.b=XztlZ3Jb; 18-d06bf9df-a011-4cee-81ed-9328a70eaa39-000000#amazonses.com"
},
{
"name": "DKIM-Signature",
"value": "v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=ly5fxy3f4dncdbipp3gron65eulkyt3p; d=areebgroup.com; t=1616424244; h=Message-ID:Date:Subjec"
},
{
"name": "DKIM-Signature",
"value": "v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=ug7nbtf4gccmlpwj322ax3p6ow6yfsug; d=amazonses.com; t=1616424244; h=Message-ID:Date:Subject:Fro"
},
{
"name": "Message-ID",
"value": "<010001785>
},
{
"name": "Date",
"value": "Mon, 22 Mar 2021 14:44:04 +0000"
},
{
"name": "Subject",
"value": "Verify Your Account"
},
{
"name": "From",
"value": "Invesna <account#aree>"
},
{
"name": "To",
"value": "areeb.**#gmail.com"
},
{
"name": "MIME-Version",
"value": "1.0"
},
{
"name": "Content-Type",
"value": "multipart/alternative; boundary=\"_=_swift_1616424243_8452744c94a6060ff23d75c5b712dcb6_=_\""
},
{
"name": "X-SES-Outgoing",
"value": "2021.03.22-54.240.48.108"
},
{
"name": "Feedback-ID",
"value": "1.us-ea"
}
],
"body": {
"size": 0
},
"parts": [
{
"partId": "0",
"mimeType": "text/plain",
"filename": "",
"headers": [
{
"name": "Content-Type",
"value": "text/plain; charset=utf-8"
},
{
"name": "Content-Transfer-Encoding",
"value": "quoted-printable"
}
],
"body": {
"size": 5094,
"data": "PCFET0NUWVBFIGh0bWw-DQo8aHRtbCBsYW5nPSJlbiI-DQo8Ym9keT4NCjxkaXYgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmN2Y5ZmM7IHBhZGRpbmctYm90dG9tOiAzcmVtIj4NCiAgICA8aW1nIHNyYz0iaHR0cDovL2FwaS10ZXN0LmludmVzbmEud9JbnZlc25hX2FwcCIgdGFyZ2V0PSJfYmxhbmsiPg0KICAgICAgICAgICAgICAgICAgICAgICAgPGltZw0KICAgICAgICAgICAgPg0KPC9ib2R5Pg0KPC9odG1sPg0K"
}
},
{
"partId": "1",
"mimeType": "text/html",
"filename": "",
"headers": [
{
"name": "Content-Type",
"value": "text/html; charset=utf-8"
},
{
"name": "Content-Transfer-Encoding",
"value": "quoted-printable"
}
],
"body": {
"size": 10026,
"data": "PCFkb2N0eXBlIGh0bWw-DQo8aHRtbCBsYW5nPSJlbiI-PGJvZHkgc3R5bGU9ImZvbnQtZmFtaWx5OiAtYXBwbGUtc3lzdGVtLCBCbGlua01hY1N5c3RlbUZvbnQsICdTZWdvZSBVSScsIFJvYm90bywgSGVsdmV0aWNhLCBBcmlhbCwgc2Fucy1zZXJpZiwgJ0FwcGxlIENvbG9yIEVtb2ppgYWx0PSJQYXR0ZXJuIiBzdHlsZT0iZm9udC1mYW1pbHk6IC1hcHBsZS1zeXN0ZW0sICAgICAgPC91bD4NCjwvZGl2Pg0KICAgIDwvZGl2Pg0KPC9kaXY-DQo8L2JvZHk-PC9odG1sPg0K"
}
}
]
},
"sizeEstimate": 20887,
"historyId": "79",
"internalDate": "16164240"
}
Resolved, my email body was encoded by base64 encoder, i decode it first then i found the link i need
Reference:
Resource: MessagePartBody

Automatic restart of workflows in node-red

I asked this question also in the node-red forum, but there is not much activity (compared to stackoverflow). So I try it here again. The motivation of my question is, that I sometime loose the connection to an OPC-UA-Server that requires restart of the flow to work again. I want to do this automatically in background, because the rare restart of the flow is no big issue - so I can live with it.
There is a thread https://discourse.nodered.org/t/how-to-restart-flows-automatically/12993 that is not really finished or solved.
I implemented the last example, but get error 400, so automatic restart of flow doesn't work. Is there any fool proof description how to do this?
EDIT:
This is the code:
[
{
"id": "3623f8cf.b4d2b8",
"type": "subflow",
"name": "restart flows",
"info": "",
"category": "",
"in": [
{
"x": 40,
"y": 80,
"wires": [
{
"id": "f24fbf79.77a74"
}
]
}
],
"out": [
{
"x": 960,
"y": 80,
"wires": [
{
"id": "cb4d3992.931138",
"port": 0
}
]
}
],
"env": [
{
"name": "user",
"type": "str",
"value": ""
},
{
"name": "password",
"type": "str",
"value": ""
}
],
"color": "#FF8888",
"inputLabels": [
"Injection"
],
"icon": "node-red/alert.svg"
},
{
"id": "f24fbf79.77a74",
"type": "function",
"z": "3623f8cf.b4d2b8",
"name": "Request Token",
"func": "var user = env.get('user');\nvar pass = env.get('password');\n\nif(user === undefined || user === null)\n{\n user = 'adminuser';\n}\nif(pass === undefined || pass === null)\n{\n pass = 'adminpass';\n}\n\nmsg.payload = {\n \"client_id\": \"node-red-editor\",\n \"grant_type\": \"password\",\n \"scope\": \"*\",\n \"username\": user,\n \"password\": pass\n}\nreturn msg;\n\n/*\nmsg.payload = {\n \"client_id\": \"node-red-editor\",\n \"grant_type\": \"password\",\n \"scope\": \"*\",\n \"username\": \"type or username\",\n \"password\": \"type your password\"\n}\nreturn msg;\n*/",
"outputs": 1,
"noerr": 0,
"x": 200,
"y": 80,
"wires": [
[
"3aedf561.e16f4a"
]
]
},
{
"id": "3aedf561.e16f4a",
"type": "http request",
"z": "3623f8cf.b4d2b8",
"name": "Token",
"method": "POST",
"ret": "txt",
"paytoqs": false,
"url": "http://servername:port/auth/token",
"tls": "",
"persist": false,
"proxy": "",
"authType": "",
"x": 390,
"y": 80,
"wires": [
[
"388fe2f5.639eee"
]
]
},
{
"id": "388fe2f5.639eee",
"type": "function",
"z": "3623f8cf.b4d2b8",
"name": "Confirm token",
"func": "// get the status of the request\nvar status = msg.statusCode;\nvar token = '';\nmsg.headers ={};\n\n//let node = feedback;\n\nswitch(status){\n case 200:\n node.log(\"Secure restart\");\n token = JSON.parse(msg.payload);\n token = 'Bearer '+token.access_token;\n msg.headers = {\n \"Authorization\": token,\n \"Node-RED-Deployment-Type\":\"reload\"\n }\n msg.payload =\"\";\n break;\n case 204:\n node.log(\"Secure without restart\");\n global.set('result','\tSuccess - with no further content');\n break;\n case 400:\n node.warn(\"Bad request\");\n break;\n case 401:\n node.warn(\"Not authorized\");\n break;\n case 403:\n node.warn(\"Forbidden\");\n break;\n case 404:\n node.log(\"Unsecure restart\");\n msg.headers = {\n \"Node-RED-Deployment-Type\":\"reload\"\n }\n break;\n case 409:\n node.warn(\"Version mismatch\");\n break;\n case 500:\n node.error(\"Server Error\");\n break;\n default:\n node.warn(\"Unknown Error\");\n break;\n}\n\nmsg.payload = \"\";\n\nsetTimeout(function() { node.send(msg) }, 10000);\n\nreturn null;",
"outputs": 1,
"noerr": 0,
"x": 580,
"y": 80,
"wires": [
[
"cb4d3992.931138"
]
],
"info": "Restart of Node-Red flows.\nWill check if the action needs security or not.\nNote: if the first 5 attemps return a statuscode 403 'forbidden'\nthen the server will break and only way to recover is then to\nrestart the service"
},
{
"id": "cb4d3992.931138",
"type": "http request",
"z": "3623f8cf.b4d2b8",
"name": "Restart",
"method": "POST",
"ret": "txt",
"paytoqs": false,
"url": "http://servername:port/flows",
"tls": "",
"persist": false,
"proxy": "",
"authType": "",
"x": 780,
"y": 80,
"wires": [
[]
]
}
]
The settings.js file is as follows:
adminAuth: {
type: "credentials",
users: [
{
username: "adminuser",
password: "adminpass",
permissions: "*"
},
Hope this helps.

After running my logic app, it shows some error message as" "We couldn't convert to Number.\r\n "

I am collecting data from sensors and upload to AZURE cosmo. My logic app on AZURE keep failing and show the following message
{
"status": 400,
"message": "We couldn't convert to Number.\r\n inner exception: We
couldn't convert to Number.\r\nclientRequestId:xxxxxxx",
"source": "sql-ea.azconn-ea.p.azurewebsites.net"
}
Below are the input data from cosmo. I saw that the input data has shown "ovf" and "inf". I have tried convert the data type of that column to other data type like bigiant and numeric and resubmitted. Still did not fixed that.
{
"Device": "DL084",
"Device_Group": "DLL",
"Time": "2019-09-04T11:45:20.0000000",
"acc_x_avg": "ovf",
"acc_x_stdev": "inf",
"acc_y_avg": "3832.88",
"acc_y_stdev": "2850.45",
"acc_z_avg": "13304.38",
"acc_z_stdev": "2289.86",
"cc_volt": "3.900293",
"cp_volt": "1.940371",
"fp_volt": "0.718475",
"id": "xxxxxxxxxxxxxxxxxxxx",
"ls_volt": "4.882698",
"millis": "1073760.00",
"rs_rpm": "0.00",
"smp_volt": "1.070381"
}
I have also tried to convert the data to string. And it will show
"Failed to execute query. Error: Operand type clash: numeric is
incompatible with ntext"
The question is how can I eliminate this error? How can I know the error is definitely due to the "inf" and "ovf" error?
The logic app code is as below
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"For_each": {
"actions": {
"Delete_a_document": {
"inputs": {
"host": {
"connection": {
"name": "#parameters('$connections')['documentdb']['connectionId']"
}
},
"method": "delete",
"path": "/dbs/#{encodeURIComponent('iot')}/colls/#{encodeURIComponent('messages')}/docs/#{encodeURIComponent(items('For_each')['id'])}"
},
"runAfter": {
"Insert_row": [
"Succeeded"
]
},
"type": "ApiConnection"
},
"Insert_row": {
"inputs": {
"body": {
"Device": "#{item()['device']}",
"Device_Group": "#{items('For_each')['devicegroup']}",
"Time": "#{addHours(addSeconds('1970-01-01 00:00:00', int(items('For_each')['time'])), 8)}",
"acc_x_avg": "#items('For_each')['acc_x_avg']",
"acc_x_stdev": "#items('For_each')['acc_x_stdev']",
"acc_y_avg": "#items('For_each')['acc_y_avg']",
"acc_y_stdev": "#items('For_each')['acc_y_stdev']",
"acc_z_avg": "#items('For_each')['acc_z_avg']",
"acc_z_stdev": "#items('For_each')['acc_z_stdev']",
"cc_volt": "#items('For_each')['cc_volt']",
"cp_volt": "#items('For_each')['cp_volt']",
"fp_volt": "#items('For_each')['fp_volt']",
"id": "#{guid()}",
"ls_volt": "#items('For_each')['ls_volt']",
"millis": "#items('For_each')['millis']",
"rs_rpm": "#items('For_each')['rs_rpm']",
"smp_volt": "#items('For_each')['smp_volt']"
},
"host": {
"connection": {
"name": "#parameters('$connections')['sql']['connectionId']"
}
},
"method": "post",
"path": "/datasets/default/tables/#{encodeURIComponent(encodeURIComponent('[dbo].[RCD]'))}/items"
},
"runAfter": {},
"type": "ApiConnection"
}
},
"foreach": "#body('Query_documents')?['Documents']",
"runAfter": {
"Query_documents": [
"Succeeded"
]
},
"type": "Foreach"
},
"Query_documents": {
"inputs": {
"body": {
"query": "SELECT \t\t * \nFROM \t\t\tc \nWHERE \t\t\tc.devicegroup = 'DLL' ORDER BY c._ts"
},
"headers": {
"x-ms-max-item-count": 1000
},
"host": {
"connection": {
"name": "#parameters('$connections')['documentdb']['connectionId']"
}
},
"method": "post",
"path": "/dbs/#{encodeURIComponent('iot')}/colls/#{encodeURIComponent('messages')}/query"
},
"runAfter": {},
"type": "ApiConnection"
}
},
"contentVersion": "1.0.0.0",
"outputs": {},
"parameters": {
"$connections": {
"defaultValue": {},
"type": "Object"
}
},
"triggers": {
"Recurrence": {
"recurrence": {
"frequency": "Minute",
"interval": 30
},
"type": "Recurrence"
}
}
}
}