Error while installing the corona sdk plugin - eclipse-plugin

This is what i a getting on my Corona Simulator Output when i try to install the 'playhaven' plugin. I don't know how to get rid of this.
Build: 2013.1202 Runtime error ?:0: attempt to call field 'request' (a nil value) stack traceback:
[C]: in function 'request'
?: in function 'downloadManifest'
?: in function 'downloadQueuedManifests'
?: in function <?:632>
?: in main chunkRuntime error
stack traceback:
[C]: in function 'request'
?: in function 'downloadManifest'
?: in function 'downloadQueuedManifests'
?: in function <?:632>
?: in main chunk
In case you wanna take a look at my build.settings file because after i integrated the plugins into the build.settings file. I recieved the error i showed above.
settings =
{
orientation =
{
default = "portrait",
supported = { "portrait" },
},
androidPermissions =
{
"android.permission.ACCESS_COARSE_LOCATION",
"android.permission.ACCESS_FINE_LOCATION",
"android.permission.INTERNET",
"android.permission.READ_PHONE_STATE",
"android.permission.ACCESS_NETWORK_STATE",
},
plugins =
{
-- key is the name passed to Lua's 'require()'
["plugin.playhaven"] =
{
-- required
publisherId = "com.playhaven",
},
},
iphone =
{
plist =
{
UIPrerenderedIcon = true,
UIApplicationExitsOnSuspend = false,
CFBundleIconFile = "Icon.png",
CFBundleIconFiles = {
"Icon.png",
"Icon#2x.png",
},
},
},
}

Playhaven is only available to Pro and Enterprise subscribers. See:
http://docs.coronalabs.com/daily/plugin/playhaven/
Are you a Pro or a Starter?

Since you gave so few information on your system and environment I can only guess. It seems that the installer tried to download something (or connect via some protocol) and failed. Did you check your firewall/proxy settings? Maybe connections are automatically refused and you are not aware of it.

Related

Karate - Polyglot Exception using js callSingle()

In the code presented below, I am trying to interact with a database through the use of a js function within the karate framework. The query used to get some data works as expected, likewise auxiliary information is accessible. The same function within the js file can be ran through groovy just fine but seems to explode when ran within karate.
JS Function to be ran in karate through a callSingle():
function() { let dbUser = Java.type('dev.dao.dbUser') return dbUser.getId(karate.properties['username'])
dbUser:
class dbUser {
static Integer getId(String email) {
db.sql.firstRow("select user_id from table.db_user where email = ?", [email]).userId
}
}
Karate-config.js
function fn() {
let config = {
project: karate.properties['vs.project'],
environment: karate.properties['vs.environment'],
baseUrl: karate.properties['vs.baseUrl'],
timeZoneId: karate.properties['vs.timeZoneId'],
env: karate.properties['vs.env'],
proxy: {
...
]
},
demoUserId: 1,
userId: karate.callSingle('classpath:proj/dev/js/dao/getDbUserId.js'),
createDBuid: karate.read('classpath:proj/dev/js/createDBuid.js'),
DBuid: karate.callonce('classpath:proj/dev/js/createDBuid.js')
}
}
Error returned calling the getDbUserId.js:
PolyglotError
<<<<
org.graalvm.polyglot.PolyglotException
com.intuit.karate.core.ScenarioBridge.callSingle(ScenarioBridge.java:243)
com.intuit.karate.core.ScenarioBridge.callSingle(ScenarioBridge.java:187)
.fn(Unnamed:18)

What are cloudflare KV preview_ids and how to get one?

I have a following wrangler.toml. When I would like to use dev or preview (e.g. npx wrangler dev or npx wrangler preview) wrangler asks to add a preview_id to the KV namespaces. Is this an identifier to an existing KV namespace?
I see there is a ticket in Cloudflare Workers GH at https://github.com/cloudflare/wrangler/issues/1458 that tells this ought to be clarified but the ticket is closed with adding an error message
In order to preview a worker with KV namespaces, you must designate a preview_id in your configuration file for each KV namespace you'd like to preview."
which is the reason I'm here. :)
As for larger context I would be really glad if someone could clarify: I see that if I give a value of an existing namespace, I can preview and I see a KV namespace of type __some-worker-dev-1234-workers_sites_assets_preview is generated in Cloudflare. This has a different identifier than the KV namespace pointed by the identifier used in the preview_id and the KV namespace pointed by the identifier I used in preview_id is empty. Why does giving an identifier of an existing KV namespace remove the error message, deploys the assets and allow for previwing but the actual KV namespace is empty and a new one is created?
How do does kv-asset-handler know to look into this generated namespace to retrieve the assets?
I'm currently testing with the default generated Cloudare Worker to my site and I wonder if I have misunderstood something or if there is some mechanics that bundles during preview/publish the site namespace to the scipt.
If there is some random mechanics with automatic mapping, can this be then so that every developer can have their own private preview KV namespace?
type = "javascript"
name = "some-worker-dev-1234"
account_id = "<id>"
workers_dev = true
kv_namespaces = [
{ binding = "site_data", id = "<test-site-id>" }
]
[site]
# The location for the site.
bucket = "./dist"
# The entry directory for the package.json that contains
# main field for the file name of the compiled worker file in "main" field.
entry-point = ""
[env.production]
name = "some-worker-1234"
zone_id = "<zone-id>"
routes = [
"http://<site>/*",
"https://www.<site>/*"
]
# kv_namespaces = [
# { binding = "site_data", id = "<production-site-id>" }
# ]
import { getAssetFromKV, mapRequestToAsset } from '#cloudflare/kv-asset-handler'
/**
* The DEBUG flag will do two things that help during development:
* 1. we will skip caching on the edge, which makes it easier to
* debug.
* 2. we will return an error message on exception in your Response rather
* than the default 404.html page.
*/
const DEBUG = false
addEventListener('fetch', event => {
try {
event.respondWith(handleEvent(event))
} catch (e) {
if (DEBUG) {
return event.respondWith(
new Response(e.message || e.toString(), {
status: 500,
}),
)
}
event.respondWith(new Response('Internal Error', { status: 500 }))
}
})
async function handleEvent(event) {
const url = new URL(event.request.url)
let options = {}
/**
* You can add custom logic to how we fetch your assets
* by configuring the function `mapRequestToAsset`
*/
// options.mapRequestToAsset = handlePrefix(/^\/docs/)
try {
if (DEBUG) {
// customize caching
options.cacheControl = {
bypassCache: true,
}
}
const page = await getAssetFromKV(event, options)
// allow headers to be altered
const response = new Response(page.body, page)
response.headers.set('X-XSS-Protection', '1; mode=block')
response.headers.set('X-Content-Type-Options', 'nosniff')
response.headers.set('X-Frame-Options', 'DENY')
response.headers.set('Referrer-Policy', 'unsafe-url')
response.headers.set('Feature-Policy', 'none')
return response
} catch (e) {
// if an error is thrown try to serve the asset at 404.html
if (!DEBUG) {
try {
let notFoundResponse = await getAssetFromKV(event, {
mapRequestToAsset: req => new Request(`${new URL(req.url).origin}/404.html`, req),
})
return new Response(notFoundResponse.body, { ...notFoundResponse, status: 404 })
} catch (e) {}
}
return new Response(e.message || e.toString(), { status: 500 })
}
}
/**
* Here's one example of how to modify a request to
* remove a specific prefix, in this case `/docs` from
* the url. This can be useful if you are deploying to a
* route on a zone, or if you only want your static content
* to exist at a specific path.
*/
function handlePrefix(prefix) {
return request => {
// compute the default (e.g. / -> index.html)
let defaultAssetKey = mapRequestToAsset(request)
let url = new URL(defaultAssetKey.url)
// strip the prefix from the path for lookup
url.pathname = url.pathname.replace(prefix, '/')
// inherit all other props from the default request
return new Request(url.toString(), defaultAssetKey)
}
}
In case the format is not obvious (it wasn't to me) here is a sample config block from the docs with the preview_id specified for a couple of KV Namespaces:
kv_namespaces = [
{ binding = "FOO", id = "0f2ac74b498b48028cb68387c421e279", preview_id = "6a1ddb03f3ec250963f0a1e46820076f" },
{ binding = "BAR", id = "068c101e168d03c65bddf4ba75150fb0", preview_id = "fb69528dbc7336525313f2e8c3b17db0" }
]
You can generate a new namespace ID in the Workers KV section of the dashboard or with the Wrangler CLI:
wrangler kv:namespace create "SOME_NAMESPACE" --preview
This answer applies to versions of Wrangler >= 1.10.0
wrangler asks to add a preview_id to the KV namespaces. Is this an identifier to an existing KV namespace?
Yes! The reason there is a different identifier for preview namespaces is so that when developing with wrangler dev or wrangler preview you don't accidentally write changes to your existing production data with possibly buggy or incompatible code. You can add a --preview flag to most wrangler kv commands to interact with your preview namespaces.
For your situation here there are actually a few things going on.
You are using Workers Sites
You have a KV namespace defined in wrangler.toml
Workers Sites will automatically configure a production namespace for each environment you run wrangler publish on, and a preview namespace for each environment you run wrangler dev or wrangler preview on. If all you need is Workers Sites, then there is no need at all to specify a kv-namepsaces table in your manifest. That table is for additional KV namespaces that you may want to read data from or write data to. If that is what you need, you'll need to configure your own namespace and add id to wrangler.toml if you want to use wrangler publish, and preview_id (which should be different) if you want to use wrangler dev or wrangler preview.

fail to create operation with c8yDeviceControl.creat

I'm new to cumulocity application development. Now I'm learning to use Smart App Toolkit to develop HTML5 application.
I could create device in my Tenant, and could run some operations with servces provided in the SDK. However, I failed to create operation with c8yDeviceControl.create(). I got 400 (bad request) error code after the operation, and if I look deeper with chrome develop tool, it shows
{error: "Failed to parse JSON string"},
Here is my code, which I pick up from the Smart SDK sample code, with modifition to reference my deviceId:
var operation = {
deviceId: 12111,
com_cumulocity_model_WebCamDevice: {
name: 'take picture',
parameters: {
duration: '5s',
quality: 'HD'
}
}
};
c8yDeviceControl.create(operation);
Could anyone provide me a help to fix this problem?
Thanks.
The deviceID needs to be a string. This works:
var operation = {
deviceId: '1211',
com_cumulocity_model_WebCamDevice: {
name: 'take picture',
parameters: {
duration: '5s',
quality: 'HD'
}
}
};
c8yDeviceControl.create(operation);
Sorry for the inconvenience, we'll update the documentation.

JSON Store is not creating in Android for latest version fix pack 7.1.0.00.20160919-1656

Below sample code is not working in latest fix on Android but if we remove the password field from options then it's working fine. We are getting below error on Android but it's working fine on IOS
{"src":"initCollection","err":-3,"msg":"INVALID_KEY_ON_PROVISION","col":"people","usr":"test","doc":{},"res":{}}
function wlCommonInit(){
/*
* Use of WL.Client.connect() API before any connectivity to a MobileFirst Server is required.
* This API should be called only once, before any other WL.Client methods that communicate with the MobileFirst Server.
* Don't forget to specify and implement onSuccess and onFailure callback functions for WL.Client.connect(), e.g:
*
* WL.Client.connect({
* onSuccess: onConnectSuccess,
* onFailure: onConnectFailure
* });
*
*/
// Common initialization code goes here
}
function onClick(){
alert("Click");
var collectionName = 'people';
// Object that defines all the collections.
var collections = {
// Object that defines the 'people' collection.
people : {
// Object that defines the Search Fields for the 'people' collection.
searchFields : {name: 'string', age: 'integer'}
}
};
// Optional options object.
var options = {
username:"test",
// Optional password, default no passw`enter code here`ord.
password : '123',
};
WL.JSONStore.init(collections, options)
.then(function () {
alert("Success in jstore");
})
.fail(function (errorObject) {
// Handle failure for any of the previous JSONStore operations (init, add).
alert("Failure in jstore : "+ JSON.stringify(errorObject));
});
};
Update: The iFix is now released. Build number is 7.1.0.0-IF201610060540 .
This is a known issue with the latest available iFix. It has been recently fixed and should be available soon.
Keep an eye out for a newer iFix release in the IBM Fix Central website for a fix for this issue.

WL.Logger.Send() its Not callback the WLClientLogReceiver adapter

I have enabled the nativeOptions: {capture: true} in initOptions.js
logger : {enabled: true, level: 'debug', stringify: true, pretty: false,
tag: {level: false, pkg: true}, whitelist: [], blacklist: [], nativeOptions: {capture: true}}
In my main js file i have the following code.
function wlCommonInit(){
// Common initialization code goes here
WL.Logger.setNativeOptions({'capture': true});
var logger = WL.Logger.create({pkg: 'mypackage'});
logger.debug('Hello world - debug');
//[mypackage] Hello world
logger.log('Hello world - log');
//[mypackage] Hello world
logger.info('Hello world - info');
//[mypackage] Hello world
logger.warn('Hello world - warn');
//[mypackage] Hello world
logger.error('Hello world - error');
//[mypackage] Hello world
WL.Logger.send(); }
WL.Logger.send() suppose to call my adapter "WLClientLogReceiver". But i am not getting any call for this adapter.
Please let me know, i need to enable any other settings to upload my client side captured log to server.
function log(deviceInfo, logMessages) {
return true;}
<procedure name="log" securityTest="wl_unprotected" audit="true" />
logger : {enabled: true, level: 'debug', stringify: true, pretty: false, tag: {level: false, pkg: true}, whitelist: [], blacklist: [], nativeOptions: {capture: true}}
You have enabled the native capture as true in initOptions.js so no need to set it again.
You can log using your package that will help you in filtering the messages based on the package in your WLClientLogReceiver adapter.
var myloggerObject = WL.Logger.create({pkg: 'mypackage'});
myloggerObject.debug("Hello world");
you can specify your level in your js file to be logged in client device.
In the adapter you will get the log messages as an json array.
function log(deviceInfo, logMessages) {
/* The adapter can choose to process the parameters,
for example to forward them to a backend server for
safekeeping and further analysis.
The deviceInfo object may look like this:
{
"appName": "wlapp",
"appVersion": "1.0",
"deviceId": "66eed0c9-ecf7-355f-914a-3cedac70ebcc",
"model": "Galaxy Nexus - 4.2.2 - API 17 - 720x1280",
"systemName": "Android",
"systemVersion": "4.2.2",
"os.arch": "i686", // Android only
"os.version": "3.4.0-qemu+" // Android only
}
The logMessages parameter is a JSON array
that contains JSON object elements, and might look like this:
[{
"timestamp" : "17-02-2013 13:54:23:745", // "dd-MM-yyyy hh:mm:ss:S"
"level" : "ERROR", // ERROR||WARN||INFO||LOG|| DEBUG
"package" : "your_tag", // typically a class name
"msg" : "the message", // a helpful log message
"threadid" : 42, // (Android only)the current thread
"metadata" : { "$src" : "js" } // metadata placed on the log call
}]
*/
//sample log and filtering method
var logs= [{
"timestamp" : "17-02-2013 13:54:23:745", // "dd-MM-yyyy hh:mm:ss:S"
"level" : "ERROR", // ERROR||WARN||INFO||LOG|| DEBUG
"package" : "your_tag", // typically a class name
"msg" : "the message", // a helpful log message
"threadid" : 42, // (Android only)the current thread
"metadata" : { "$src" : "js" } // metadata placed on the log call
},
{
"timestamp" : "17-02-2013 13:54:23:745", // "dd-MM-yyyy hh:mm:ss:S"
"level" : "ERROR", // ERROR||WARN||INFO||LOG|| DEBUG
"package" : "mypackage", // typically a class name
"msg" : "my package message", // a helpful log message
"threadid" : 42, // (Android only)the current thread
"metadata" : { "$src" : "js" } // metadata placed on the log call
}
];
var filteredLogs = logs.filter(function(log){
if(log.package == mypackage) //comparing the package and returns the object
{ return log; }
});
WL.Logger.error(filteredLogs);// This is send only the filtered array to your server
}
If you log using metadata such as filename along with the debug message you will get those in the array in metadata attribute.
It is suggested to stringify and parse the object to avoid errors before parsing the device logs in the adapter.
var logs = JSON.stringify(JSON.parse(logs));
var filteredLogs = logs.filter ...
Hope this will work for you.
Make sure you test it using the device.
The send function is not attached to the LogInstance prototype, which is what you're using when you use a logger instance created with WL.Logger.create(). Please call
WL.Logger.send();
instead.
(Above was posted prior to OP's edit.)
Since setNativeOptions is an asynchronous call (it calls down through a Cordova plugin), it is possible it has not successfully turned capture on prior to completion of the subsequent logger calls. So at the time of the call to WL.Logger.send(); nothing has been collected yet.
Do this:
function wlCommonInit() {
// Common initialization code goes here
WL.Logger.setNativeOptions({'capture': true})
.then(function() {
var logger = WL.Logger.create({pkg: 'mypackage'});
logger.debug('Hello world - debug');
//[mypackage] Hello world
logger.log('Hello world - log');
//[mypackage] Hello world
logger.info('Hello world - info');
//[mypackage] Hello world
logger.warn('Hello world - warn');
//[mypackage] Hello world
logger.error('Hello world - error');
//[mypackage] Hello world
WL.Logger.send();
});
}
Be sure to check the server-side logs. The audit="true" in the adapter's descriptor file will print the parameters passed to the adapter inline in the server logs (messages.log on WebSphere Liberty).