I've created an Alexa skill based on the Hello World template using the ASK CLI. The skill is called demo-skill. I want to use the ask api update-skill command to update the skill to reflect local changes that I've made to the en-US.json file in the demo-skill project structure. This is the command I'm using:
ask api update-skill --skill-id <my skill id> --file <my working directory>/demo-skill/models/en-US.json
This is the error I'm receiving:
Call update-skill error.
Error code: 400
{
"message": "Skill manifest is not valid.",
"violations": [
{
"code": "INVALID_REQUEST_PARAMETER",
"message": "Instance at property path \"$\" has an invalid number of properties. Actual properties: 0, Minimum properties: 1",
"validationDetails": {
"originalInstance": {
"propertyPath": "$",
"type": "BODY"
},
"reason": {
"actualProperties": 0,
"minimumProperties": 1,
"type": "INVALID_NUMBER_OF_PROPERTIES"
}
}
}
]
}
Can someone please explain what parameter is missing here and how can I update a skill using the CLI if what I'm doing is wrong?
The command you are using is to update the schema of the skill, vs the interaction model.
The corollary to 'get' the schema is:
ask api get-skill -s {skill_id} --stage development > skill.json
If you turn around and put the output of that command into your command:
ask api update-skill --skill-id <my skill id> --file skill.json
you should find that the command executes successfully.
You may be looking for:
ask api update-model <-s|--skill-id <skillId>> <-f|--file <fileName>> <-l|--locale <locale>> [-g|--stage <stage>] [-d|--description <description>] [-p|--profile <profile>] [--debug]
Here are the docs for that:
ASK CLI command reference
Related
I build a GraphQL API with Apollo and Prisma ORM which is connected to my hosted MySQL Database (The Database has already content in it).
When I run it on my localhost everything works fine and I can query the Database with GraphQL statements.
As soon as I deploy my node.js project to DigitalOcean (auto deployed with GitHub) it stops working and I get the following error:
{
"errors": [
{
"message": "\nInvalid `prisma.content.findMany()` invocation in\n/workspace/src/schema.js:36:29\n\n 33 const resolvers = {\n 34 Query: {\n 35 memes: (parent, args) => {\nā 36 return prisma.content.findMany(\n error: Error validating datasource `db`: the URL must start with the protocol `mysql://`.\n --> schema.prisma:7\n | \n 6 | provider = \"mysql\"\n 7 | url = env(\"DATABASE_URL\")\n | \n\nValidation Error Count: 1",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"memes"
],
"extensions": {
"code": "INTERNAL_SERVER_ERROR",
"exception": {
"clientVersion": "3.6.0",
"stacktrace": [
"Error: ",
"Invalid `prisma.content.findMany()` invocation in",
"/workspace/src/schema.js:36:29",
"",
" 33 const resolvers = {",
" 34 Query: {",
" 35 memes: (parent, args) => {",
"ā 36 return prisma.content.findMany(",
" error: Error validating datasource `db`: the URL must start with the protocol `mysql://`.",
" --> schema.prisma:7",
" | ",
" 6 | provider = \"mysql\"",
" 7 | url = env(\"DATABASE_URL\")",
" | ",
"",
"Validation Error Count: 1",
" at cb (/workspace/node_modules/#prisma/client/runtime/index.js:38689:17)",
" at processTicksAndRejections (internal/process/task_queues.js:97:5)"
]
}
}
}
],
"data": null
}
Here is my schema.prisma file:
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "mysql"
url = env("DATABASE_URL")
}
...
The only thing that is different from the hosted project compared to the local project is that I put .env file and node_modules on the .gitignore file.
So it seems like the project is accessing the wrong DATABASE_URL, but how should the hosted project know the DATABASE_URL in my .env file when the .env file is on .gitignore?
Here is what I do:
Change the DATABASE_URL in my .env file to my local MySQL Database hosted on a docker container
Run npx prisma migrate dev --preview-feature to generate the migration files
Run git add .
Run git commit -m "New Commit"
Run DATABASE_URL=mysql://censored:censored#censored:3306/censored npx prisma migrate resolve --applied "my_migration_folder_name" --preview-feature which succeeds and tells me "Migration my_migration_folder_name marked as applied."
Run git push
I can see that the Migration is successfully created on my MySQL Database but as soon as I run the app and try to query the database it gives me that error.
The code has to be correct because it is working on my localhost even when querying the hosted MySQL Database.
I also double checked that the Model in the schema.prisma file is in sync with my hosted MySQL Database schema.
I'm running out of ideas on what I could try.
EDIT
I actually think it has something to do with the environment variables I set in the settings of my DigitalOcean application.
Before it was set to:
envs:
- key: DATABASE_URL
scope: RUN_AND_BUILD_TIME
value: ${db.DATABASE_URL}
Now I set it to:
envs:
- key: DATABASE_URL
scope: RUN_AND_BUILD_TIME
value: mysql://censored:cesnored#censored:3306/censored
I thought that this will fix the problem but now it tells me that the connection fails because of wrong database credentials even though it is the right link with the right credentials.
I fixed it by clicking "Force rebuild and deploy" on my digitalOcean app.
I am sending the following valid JSON as a message via MQTT to a device :
{
"devices": [
{
"known": true,
"local": false,
"eep": "MSC_V3_PRESSAC_20",
"id": "01:96:23:83",
"O_nominalVoltage": 120
}
],
"uuid": "821ca781-dd98-4531-8391-19d4e4da2c96"
}
but I receive the following error back :
"Handling command: org.json.JSONException: Expected a ',' or '}' at character 62 of {devices:[{known:true,local:false,eep:MSC_V3_PRESSAC_20,id:01:96:23:83,O_nominalVoltage:120}],uuid:821ca781-dd98-4531-8391-19d4e4da2c96}"
}
Can anyone see anything wrong with this? I don't understand why there is a problem with character 62.
For more information, I am sending the message via the mosquitto_pub command when publishing to an MQTT topic on a remote device.
My device is running Java code which uses the Java Paho libraries. I am using the AWS IoT MQTT broker.
I want to create Version for ML Engine Model by Rest API and set as default. kindly help me and suggest what is the mistake that I am doing.Sending below request and hitting the post API Below.
Trying hitting by Google Auth Playground.
Post URL : https://ml.googleapis.com/v1/projects//models//versions
Request Body :
{
"name": "v4",
"description": "This is test Version created by API",
"isDefault": True,
"deploymentUri": "gs://car-hertz/vans-uk-hertz/output/v1/F0/export/exporter/1531390162/",
"runtimeVersion": "1.4",
"framework": enum(TENSORFLOW),
"pythonVersion": "2.7"
}
In the REST API docs for the Version resource you can see in the description for the framework field that:
Valid values are TENSORFLOW, SCIKIT_LEARN, and XGBOOST
enum(Framework) is just the field's type. Also, from that same link: isDefault field is output only. You shouldn't include it in the request to create a model version. From the docs for the create method:
If you want a new version to be the default, you must call
projects.models.versions.setDefault.
So, to create a new model version and set it as default via REST API:
Put the request payload in a json file:
{
"name": "v4",
"description": "This is test Version created by API",
"deploymentUri": "gs://car-hertz/vans-uk-hertz/output/v1/F0/export/exporter/1531390162/",
"runtimeVersion": "1.4",
"framework": "TENSORFLOW",
"pythonVersion": "2.7"
}
Create the version by running in a shell the following (I like to use a gcurl alias):
alias gcurl='curl -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" -H "Content-Type: application/json" '
gcurl -X POST -T "$REQUEST_FILEPATH" https://ml.googleapis.com/v1/projects/$PROJECT/models/$MODEL/versions
Set the above as the default:
gcurl -X POST https://ml.googleapis.com/v1/projects/$PROJECT/models/$MODEL/versions/v4:setDefault
I'm trying to create a managed policy by AWS CLI:
POLICY='
{
"Version":"2012-10-17",
"Statement":
[{
"Effect":"Allow",
"Action":
[
"cloudformation:*"
],
"Resource":"*"
},
{
"Effect":"Deny",
"Action":
[
"cloudformation:UpdateStack",
"cloudformation:DeleteStack"
],
"Resource": "'${arn}'"
}]
}'
# Create policy if not already created
[ $(aws iam list-policies | grep -ce CloudFormation-policy-${StackName}) -eq 0 ] && (aws iam create-policy --policy-name CloudFormation-policy-${StackName} --policy-document "'${POLICY}'")
When I run the script I get this error:
An error occurred (MalformedPolicyDocument) when calling the CreatePolicy operation: Syntax errors in policy.
I can't figure out where the error is.
Any idea?
Each operating systems has its own way of treating single quote vs double quote escaping and as per AWS CLI documentation:
When passing in large blocks of data, you might find it easier to save
the JSON to a file and reference it from the command line. JSON data
in a file is easier to read, edit, and share with others.
Quoting Strings approach might not be best choice while passing Json data, instead use Loading parameters from file approach.
BrowserStack now offers a ScreenShot API which allows you to post a request and receive back HTML/JSON with a link to generated screen shot images stored on their server:
http://www.browserstack.com/screenshots/api
The examples are sparse, and use CURL to do all the transport.
1) What is the quick and dirty way to automate w/curl and dump these screens into a folder
2) How would one consume this request architectural in a .NET console/web app to automate this process?
This seems so new there is no documentation or examples on its usage anywhere.
An example request:
curl -u "username:password" -H "Accept: application/json" -d 'data={"browsers": [{"os": "Windows", "os_version": "7", "browser_version": "8.0", "browser": "ie"}], "url": "http://google.com"}' http://www.browserstack.com/screenshots
And the response:
Response {
"job_id":"13b93a14db22872fcb5fd1c86b730a51197db319",
"callback_url": "http://staging.example.com",
"win_res": "1024x768",
"mac_res": "1920x1080",
"quality": "compressed",
"screenshots": [{
"os":"Windows",
"os_version":"XP",
"browser":"ie",
"id":"be9989892cbba9b9edc2c95f403050aa4996ac6a",
"state":"pending",
"browser_version":"7.0",
"url":"www.google.com"
},
{
"os":"Windows",
"os_version":"7",
"browser":"ie",
"id":"1f3a6054e09592e239e9ea79c247b077e68d3d71",
"state":"pending",
"browser_version":"8.0",
"url":"www.google.com"
}
....
]
}
Get status of screenshots in queue
Usage GET /screenshots/<JOB-ID>.json
etc.
The answer to this is to use CURL and read the CURL help files and find a good GUI tool (duh).