Heroku gives wrongly formatted error vs Local is working fine - heroku

The application works fine locally. However deploying it in heroku gives the following error without any clue
com.github.dandelion.core.DandelionException: The file
'WEB-INF/classes/dandelion/my-bundle.json' is wrongly formatted.
Please help me on how to resolve this.
Below is the JSON file for reference.
Below is the json file used in the deployment for your reference.
{
"bundle" : "my-bundle",
"assets": [
{
"name": "jquery",
"version": "2.1.1",
"type": "js",
"locations": {
"webapp": "/webjars/jquery/2.1.1/jquery.min.js"
}
},
{
"name": "datatables",
"version": "1.10.5",
"type": "js",
"locations": {
"webapp": "/webjars/datatables/1.10.5/js/jquery.dataTables.js"
}
},
{
"name": "datatables",
"version": "1.10.5",
"type": "css",
"locations": {
"webapp": "/webjars/datatables/1.10.5/css/jquery.dataTables.css"
}
}
]
}
Thanks.

Related

Manifest parsing error when trying to test app in Teams

From https://dev.teams.microsoft.com/, whenever I click "Preview in Teams", it shows an error in Teams with these details copied to the clipboard: "Error while reading manifest.json". If I download the app package and "upload a custom app" I get the same error. What can I do to resolve this? If I remove the messaging extension configuration, it works but I configured that part in their app and that's what I want to build.
This is my manifest file:
{
"$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.11/MicrosoftTeams.schema.json",
"version": "1.0.0",
"manifestVersion": "1.11",
"id": "3fXXXX",
"packageName": "com.package.name",
"name": {
"short": "Domo Integration",
"full": ""
},
"developer": {
"name": "Domo Inc.",
"mpnId": "",
"websiteUrl": "https://www.domo.com",
"privacyUrl": "https://www.domo.com/company/privacy-policy",
"termsOfUseUrl": "https://www.domo.com/company/service-terms"
},
"description": {
"short": "short",
"full": "full"
},
"icons": {
"outline": "outline.png",
"color": "color.png"
},
"accentColor": "#FFFFFF",
"composeExtensions": [
{
"botId": "deXXXXXXXX",
"commands": [],
"canUpdateConfiguration": true,
"messageHandlers": [
{
"type": "link",
"value": {
"domains": [
"*.domo.com"
]
}
}
]
}
],
"validDomains": [
"*.domo.com"
]
}
#ccnokes In order to use messaging extension in your bot, you need to provide at least one command. commands is required property in composeExtension - see doc.
I was also getting the same error when tried with your manifest but after adding commands it worked totally fine.

web app works locally and on app engine, but not on cloud run

So I've run into this issue with a web app I've made:
it gets a file path as input
if the file exists on a bucket, it uses a python client api to create a compute engine instance
it passes the file path to the instance in the startup script
When I ran it locally, I created a python virtual environment and then ran the app. When I make the input on the web browser, the virtual machine is created by the api call. I assumed it used my personal account. I changed to the service account in the command line with this command 'gcloud config set account', it ran fine once more.
When I simply go to the source code directory deploy it as is, the application can create the virtual machine instances as well.
When I use Google cloud build and deploy to cloud run, it doesn't create the vm instance.
the web app itself is not throwing any errors, but when I check compute engine's logs, there is an error in the logs:
`{
"protoPayload": {
"#type": "type.googleapis.com/google.cloud.audit.AuditLog",
"status": {
"code": 3,
"message": "INVALID_PARAMETER"
},
"authenticationInfo": {
"principalEmail": "####"
},
"requestMetadata": {
"callerIp": "#####",
"callerSuppliedUserAgent": "(gzip),gzip(gfe)"
},
"serviceName": "compute.googleapis.com",
"methodName": "v1.compute.instances.insert",
"resourceName": "projects/someproject/zones/somezone/instances/nameofinstance",
"request": {
"#type": "type.googleapis.com/compute.instances.insert"
}
},
"insertId": "######",
"resource": {
"type": "gce_instance",
"labels": {
"instance_id": "#####",
"project_id": "someproject",
"zone": "somezone"
}
},
"timestamp": "2021-06-16T12:18:21.253551Z",
"severity": "ERROR",
"logName": "projects/someproject/logs/cloudaudit.googleapis.com%2Factivity",
"operation": {
"id": "operation-#####",
"producer": "compute.googleapis.com",
"last": true
},
"receiveTimestamp": "2021-06-16T12:18:21.253551Z"
}`
In theory, it is the same exact code that worked from my laptop and on app engine. I'm baffled why it only does this for cloud run.
App engines default service account was stripped of all its roles and given a custom role tailored to the web apps function.
The cloud run is using a different service account, but was given that exact same custom role.
Here is the method I use to call the api.
def create_instance(path):
compute = googleapiclient.discovery.build('compute', 'v1')
vmname = "piinnuclei" + date.today().strftime("%Y%m%d%H%M%S")
startup_script = "#! /bin/bash\napt update\npip3 install pg8000\nexport BUCKET_PATH=my-bucket/{}\ngsutil -m cp -r gs://$BUCKET_PATH /home/connor\ncd /home/connor\n./cloud_sql_proxy -dir=cloudsql -instances=sql-connection-name=unix:sql-connection-name &\npython3 run_analysis_upload.py\nexport ZONE=$(curl -X GET http://metadata.google.internal/computeMetadata/v1/instance/zone -H 'Metadata-Flavor: Google')\nexport NAME=$(curl -X GET http://metadata.google.internal/computeMetadata/v1/instance/name -H 'Metadata-Flavor: Google')\ngcloud --quiet compute instances delete $NAME --zone=$ZONE".format(path)
config = {
"kind": "compute#instance",
"name": vmname,
"zone": "projects/my-project/zones/northamerica-northeast1-a",
"machineType": "projects/my-project/zones/northamerica-northeast1-a/machineTypes/e2-standard-4",
"displayDevice": {
"enableDisplay": False
},
"metadata": {
"kind": "compute#metadata",
"items": [
{
"key": "startup-script",
"value": startup_script
}
]
},
"tags": {
"items": []
},
"disks": [
{
"kind": "compute#attachedDisk",
"type": "PERSISTENT",
"boot": True,
"mode": "READ_WRITE",
"autoDelete": True,
"deviceName": vmname,
"initializeParams": {
"sourceImage": "projects/my-project/global/images/my-image",
"diskType": "projects/my-project/zones/northamerica-northeast1-a/diskTypes/pd-balanced",
"diskSizeGb": "100"
},
"diskEncryptionKey": {}
}
],
"canIpForward": False,
"networkInterfaces": [
{
"kind": "compute#networkInterface",
"subnetwork": "projects/my-project/regions/northamerica-northeast1/subnetworks/default",
"accessConfigs": [
{
"kind": "compute#accessConfig",
"name": "External NAT",
"type": "ONE_TO_ONE_NAT",
"networkTier": "PREMIUM"
}
],
"aliasIpRanges": []
}
],
"description": "",
"labels": {},
"scheduling": {
"preemptible": False,
"onHostMaintenance": "MIGRATE",
"automaticRestart": True,
"nodeAffinities": []
},
"deletionProtection": False,
"reservationAffinity": {
"consumeReservationType": "ANY_RESERVATION"
},
"serviceAccounts": [
{
"email": "batch-service-accountg#my-project.iam.gserviceaccount.com",
"scopes": [
"https://www.googleapis.com/auth/cloud-platform"
]
}
],
"shieldedInstanceConfig": {
"enableSecureBoot": False,
"enableVtpm": True,
"enableIntegrityMonitoring": True
},
"confidentialInstanceConfig": {
"enableConfidentialCompute": False
}
}
return compute.instances().insert(
project="my-project",
zone="northamerica-northeast1",
body=config).execute()
The issue was with the zone. For some reason, when it was ran on cloud run, the code below was the culprit.
return compute.instances().insert(
project="my-project",
zone="northamerica-northeast1",
body=config).execute()
"northamerica-northeast1" should have been "northamerica-northeast1-a"
EDIT:
I made a new virtual machine image and quickly ran into the same problem, it would work locally and break down in the cloud run environment. After letting it sit for some time, it began to work again. This is leading me to the conclusion that there is also some sort of delay before it can be called by cloud run.

Heroku: There was an issue setting up your app environment. Name is invalid

When I try to use this app.json:
{
"stack": "heroku-18",
"repository": "https://github.com/OpenHumans/oh-data-source-template",
"logo": "https://avatars.githubusercontent.com/u/3341265?s=280&v=4",
"scripts": {
"postdeploy": "python manage.py init_proj_config"
},
"env": {
"SECRET_KEY": {
"description": "This is set for you and is used to encrypt data.",
"generator": "secret"
},
"OH_CLIENT_ID": {
"description": "See http://openhumans.org/direct-sharing/projects/manage",
"value": ""
},
"OH_CLIENT_SECRET": {
"description": "See http://openhumans.org/direct-sharing/projects/manage",
"value": ""
},
"OH_ACTIVITY_PAGE": {
"description": "See http://openhumans.org/direct-sharing/projects/manage",
"value": ""
},
"APP_BASE_URL ": {
"description": "e.g. https://your-app-name.herokuapp.com - no trailing slash!",
"value": "https://your-app-name.herokuapp.com"
},
"DEBUG": {
"description": "Displays detailed error info for web requests. Set False in production.",
"value": "false"
},
"HEROKU_APP": {
"description": "If true, ALLOWED_HOSTS is set to all.",
"value": "true"
}
},
"addons": [
"coralogix:free-30mbday",
"heroku-redis:hobby-dev",
{
"plan": "heroku-postgresql",
"options": {
"version": "9.5"
}
}
]
}
to deploy from:
https://dashboard.heroku.com/new?template=https%3A%2F%2Fgithub.com%2Fmikepsinn%2Foh-quantimodo-source
I get the error no matter what I set the name to:
I've tried adding the optional name field to the app.json but that doesn't help either.

Chat bot Hands-Off published on azure - gives connection error emulator :Cannot post activity. Unauthorized

I have been trying to host bot which works on local to the Azure Hosting.
I'm trying to connect hosted bot with local emulator gives connection error (emulator :Cannot post activity. Unauthorized).
My .bot file:
{
"name": "production",
"description": "",
"services": [
{
"type": "endpoint",
"appId": "********************",
"appPassword": "*************",
"endpoint": "intermediatorbotsample2019.azurewebsites.net/api/messages",
"name": "AzureAccountLive",
"id": "178"
}
],
"padlock": "",
"version": "2.0",
"path": "D:\\Architecture\IntermediatorBot\\production.bot",
"overrides": null
}
I took a look at your bot file in your comment. The problem is that you have "name": "AzureAccountLive" in your services section. This name MUST be "production". The outer level "name" has to match the name of the bot (in this case, it's probably intermediatorbotsample2019). It's the Name:Production, Type:Endpoint combination that ABS looks for. If you update your botfile to match what I have below, your bot should work as expected.
{
"name": "YOURBOTNAMEHERE",
"description": "",
"services": [
{
"type": "endpoint",
"appId": "********************",
"appPassword": "*************",
"endpoint": "http://intermediatorbotsample2019.azurewebsites.net/api/messages",
"name": "production",
"id": "178"
}
],
"padlock": "",
"version": "2.0",
"path": "D:\\Architecture\IntermediatorBot\\production.bot",
"overrides": null
}
Re genreted AppId and secret from https://dev.botframework.com/.
Previously was using AzureBotProject replaced it with AzureBotChannelProject instead.

Trouble connecting to SQL Server Express with a C# AWS Lambda function

I get the following error when trying to connect to my SQL Server Express RDS instance over AWS Lambda using System.Data.SqlClient:
"errorType": "PlatformNotSupportedException",
"errorMessage": "Operation is not supported on this platform.",
"stackTrace": [
"at System.Runtime.InteropServices.OSPlatform.get_Windows()",
"at System.Data.SqlClient.SNI.SNITCPHandle.d__22.MoveNext()"
]
I build the deploy package using Amazon.Lambda.Tools. Running the function and connecting to the database from local works fine, but fails when trying to run it on AWS Lambda.
Here is my project.json:
{
"version": "1.0.0-*",
"description": "AWS lambda Console Application",
"authors": [ "" ],
"packOptions": {
"tags": [],
"projectUrl": "",
"licenseUrl": ""
},
"buildOptions": {
"emitEntryPoint": true
},
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.0"
},
"Newtonsoft.Json": "9.0.1",
"Amazon.Lambda.Core": "1.0.0*",
"Amazon.Lambda.Serialization.Json": "1.0.1",
"Amazon.Lambda.Tools": {
"type": "build",
"version": "1.0.0-preview1"
},
"Dapper": "1.50.2",
"System.Data.SqlClient": "4.3.0"
},
"tools": {
"Amazon.Lambda.Tools": "1.0.0-preview1"
},
"commands": {
"AwsLambda": "run"
},
"frameworks": {
"netcoreapp1.0": {
"imports": "dnxcore50"
}
}
}
Had the same problem and for me just changing
"System.Data.SqlClient": "4.3.0"
to
"System.Data.SqlClient": "4.1.0"
worked for me. I did not have to change the NetCore.App dependencies.
Explicitly add reference to
"System.Data.SqlClient": "4.1.0",
"System.Runtime.InteropServices.RuntimeInformation": "4.0.0"
solves the problem.
Can you try to change
"System.Data.SqlClient": "4.3.0"
to
"System.Data.SqlClient": "4.1.0"
and change
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.0"
},
to
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.1"
},

Resources