This question is related application loading without css. I checked the java script console and get issues
Uncaught ReferenceError: Shiny is not defined
at (index):21
Uncaught ReferenceError: shinyjs is not defined
at (index):39
The script at index 21 in source:
`<script>Shiny.addCustomMessageHandler('shinyjs-show', function(params) { shinyjs.debugMessage('shinyjs: calling function "show" with parameters:'); shinyjs.debugMessage(params); shinyjs.show(params);})`;
The application is running on shiny-server on CentOs 6.
Make sure you call shinyjs::useShinyjs() somewhere within the session running the app.
Normally you would include this as part of the shiny UI.
But if the UI was created inside a package, then it might call useShinyjs when the package is built or installed and not in the session where the app is running.
That is probably the issue (referring to your comment).
As indicated here, install your packages with:
sudo su - -c "R -e \"install.packages('shiny', repos='http://cran.rstudio.com/')\""
This is because your apps will be ran by a user called shiny, user which probably cannot access the package shiny because you installed it as another user.
The problem is probably, because you run the code before Shiny object is created by shiny. If you look at the code of shiny it have this:
$(function() {
// Init Shiny a little later than document ready, so user code can
// run first (i.e. to register bindings)
setTimeout(initShiny, 1);
});
init_shiny.js#L511
you can use this function that I'm using:
var shinyReady = (function() {
var callbacks = $.Callbacks();
$(function() {
setTimeout(function() {
callbacks.fire();
callbacks = null;
}, 100); // this probably can be 2 since shiny use 1
});
return function(callback) {
if (callbacks) {
callbacks.add(callback);
} else {
callback();
}
};
})();
shinyReady(function() {
// your code that use Shiny object
});
Related
I am sending a request from my Meteor server to download a file via an API. I then want to upload that file to S3. I keep getting the following "NoSuchKey: The specified key does not exist." I initially thought it was maybe a problem with my AcessKey/SecretKey form AWS but after googling this for a while the only examples I could find of other people getting this error is when trying to download a file from S3.
Setting up cfs:s3
var imageStore = new FS.Store.S3("images", {
accessKeyId: "MyAcessKeyId", //required if environment variables are not set
secretAccessKey: "MySecretAcessKey", //required if environment variables are not set
bucket: "BucketName", //required
});
Images = new FS.Collection("images", {
stores: [imageStore]
});
Start file transfer from API and upload to S3
client.get_result(id, Meteor.bindEnvironment(function(err, result){ //result is the download stream and id specifies which file to download.
if (err !== null){
return;
}
var file = new FS.File(result);
Images.insert(file, function (err, fileObj) {
if (err){
console.log(err);
}
});
}));
Note: I was getting the following error so I added Meteor.bindEnvironment.
"Meteor code must always run within a Fiber. Try wrapping callbacks that you pass to non-Meteor libraries with Meteor.bindEnvironment."
Node.js example from API Documentation
client.get_result(id, function(err, result){
if (err != null) {
return;
}
file.writeFile(path.join('public', path.join('results', filename)), result, 'binary');
});
What ended up fixing the problem for me was moving part of the setup to the lib folder. Although I tried several different ways I was unable to get it to execute entirely on the server. It looks like the documentation was updated recently which states everything a bit more clearly. If you follow this setup it should eliminate the error. See the section titled Client, Server, and S3 credentials
https://github.com/CollectionFS/Meteor-CollectionFS/tree/master/packages/s3
Note: Make sure not to place you secret key is not in you lib folder as this is accessible from the client.
I started the meteor-testing tutorial, but the 2nd automatic generated test fails with:
TypeError: Cannot call method 'url' of undefined
So it seems that the client variable is not defined. Did anybody experience similar issues? (btw is there a way to debug this)
i'm using ubuntu 14.04 with
Meteor 1.2.0.2
node v4.0.0
xolvio:cucumber 0.19.4_1 CucumberJS for Velocity
Update:
Generated test code intests/cucumber/features/step_definitions/sample_steps.js:
// You can include npm dependencies for support files in tests/cucumber/package.json
var _ = require('underscore');
module.exports = function () {
// You can use normal require here, cucumber is NOT run in a Meteor context (by design)
var url = require('url');
// 1st TEST OK
this.Given(/^I am a new user$/, function () {
server.call('reset'); // server is a connection to the mirror
});
// 2nd TEST FAIL
this.When(/^I navigate to "([^"]*)"$/, function (relativePath) {
// process.env.ROOT_URL always points to the mirror
client.url(url.resolve(process.env.ROOT_URL, relativePath));
});
...
};
I was said to file an issue in the chimp repository, where I was pointed to the solution:
// 2nd TEST FAIL
this.When(/^I navigate to "([^"]*)"$/, function (relativePath) {
// REPLACE client with browser
browser.url(url.resolve(process.env.ROOT_URL, relativePath));
});
This is a short fix, but I'm not sure whether you should later rather use client (seems to be wrapper for different environments).
**Update: ** meanwhile this was fixed, no adaption necessary anymore
I'm using the Javascript SDK and Appccelerator Titanium. The Javascript SDK doesn't have a function to save deviceToken's for enabling push. I've tried various methods but the one that should work (does not) is saving via a Cloud Function. What am I doing wrong?
Parse.Cloud.define("subscribeToPush", function(request, response) {
Parse.Cloud.useMasterKey();
var Installation = Parse.Object.extend("Installation");
var membership = new Installation();
membership.set("deviceType", request.params.os);
membership.set("deviceToken", request.params.deviceToken);
membership.set("channels", ["general"]);
membership.save(null,{
success:function(membership) {
response.success(membership);
},
error:function(error) {
response.error(error);
}
});
});
After running this function Cloud Log shows that it was created, yet, I don't see it in the data browser.
I2014-10-22T01:29:30.319Z] v51: Ran cloud function subscribeToPush for user rCzHEXY5hN with:
Input: {"deviceType":"ios","deviceToken":"xxxXXXxxx","channels":["general"]}
Result: {"deviceToken":"xxxXXXxxx","channels": "general"],"objectId":"KCWtpcwy4i","createdAt":"2014-10-22T01:29:30.383Z","updatedAt":"2014-10-22T01:29:30.383Z","__type":"Object","className":"Installation"}
My application is not spiderable both on local and production.
When I go to http://localhost:3000/?_escaped_fragment_=, I can see the following error appears (phantom is killed after 15 seconds):
spiderable: phantomjs failed: { [Error: Command failed: ] killed: true, code: null, signal: 'SIGTERM' }
It seems that many other people got this problem:
https://github.com/gadicc/meteor-phantomjs/issues/1
https://groups.google.com/forum/#!msg/meteor-talk/Lnm9HFs4MgM/YKDMR80fVecJ
https://groups.google.com/forum/#!topic/meteor-talk/7ZbidddRGo4
The thing is I am not using observatory or select2 and all my publications return a cursor. According to me, the problem comes from the minification. I just read in this thread that someone succeed to display "SyntaxError: Parse error". How can I know more about what is going wrong with Phantom and which file is causing the problem?
This happens when spiderable is waiting for subscriptions that fail to return any data and end up timing out, as mentioned in some of the threads you linked.
Make sure that all of your publish functions are either returning a cursor, a (possibly empty) list of cursors, or sending this.ready().
Meteor APM may be useful in determining which publications aren't returning.
If you want to know more about what is wrong with phatomjs, you might try this code (1):
// Put your URL below, no "?_escaped_fragment_=" necessary
var url = "http://your-url.com/";
var page = require('webpage').create();
page.open(url);
setInterval(function() {
var ready = page.evaluate(function () {
if (typeof Meteor !== 'undefined'
&& typeof(Meteor.status) !== 'undefined'
&& Meteor.status().connected) {
Deps.flush();
return DDP._allSubscriptionsReady();
}
return false;
});
if (ready) {
var out = page.content;
out = out.replace(/<script[^>]+>(.|\n|\r)*?<\/script\s*>/ig, '');
out = out.replace('<meta name=\"fragment\" content=\"!\">', '');
console.log(out);
phantom.exit();
}
}, 100);
For use in local, install phantomjs. Then outside your app, create a file phantomtest.js with the code above. And run phantomjs phantomtest.js
Another thing that maybe you can try is to use UglifyJS to catch some errors in the minified JS file as Payner35 did.
My problem was coming from SSL. You can have a complete overview of what I did here.
Edit the spiderable source and add --ignore-ssl-errors=yes to the phantomjs command line, it will work.
I am just starting to build a new Meteor app. The only thing I have done so far is add one Collection. It will start, run fine for about 5 minutes, and then give me the error message "Failed to receive keepalive! Exiting."
What is failing to receive keepalive from what? I assume this has something to do with Mongo since that is the only thing I have added. Googling the error message turns up nothing except Meteor sites that are just showing this error message instead of the their app.
My MongoDB collection already had data in it that was not created by Meteor and it is over 4GB if that makes any difference.
This is the complete app.
pitches_sum = new Meteor.Collection( 'pitches_sum' );
if (Meteor.is_client) {
Template.hello.greeting = function () {
return "Welcome to my site.";
};
Template.hello.events = {
'click input' : function () {
// template data, if any, is available in 'this'
if (typeof console !== 'undefined')
console.log("You pressed the button");
}
};
}
if (Meteor.is_server) {
Meteor.startup(function () {
console.log( '**asdf**' );
});
}
If I comment out the pitches_sum = new Meteor.Collection( 'pitches_sum' ); line, then I don't think I will get the error message any more.
This was being caused by my large data set and autopublish. Since autopublish was on, Meteor was trying to send the whole 4GB collection down to the client. Trying to process all the data prevented the client from responding to the server's keep alive pings. Or something to that effect.
Removing autopublish with meteor remove autopublish and then writing my own publish and subscribe functions fixed the problem.