I have a meteor code that works just fine when running localhost, but when I deploy it in Google Cloud, almost everything works, except one of my pages that contains a form, and that form I pre-populate with data coming from the server.
This is my HTML:
<template name="ConfigForm">
{{ #with configurationData }}
<form class="update-config">
<div class="row">
<div class="col-lg-6">
<p>Email Recipients</p>
</div>
<div class="col-lg-6">
<label for="decimal" class="sr-only">Email Recipients</label>
<input type="text" id="send_to_email" class="form-control" placeholder="Email Recipients" autofocus value="{{ send_to_email }}">
</div>
</div>
....
Then, my javascript file for this particular page has:
Template.ConfigForm.onCreated(function bodyOnCreated() {
Meteor.call('getConfig',function(err,response) {
if(err) {
console.error('Error')
return;
}
Session.set('config', response);
});
});
Template.ConfigForm.helpers({
configurationData: function() {
return Session.get('config')
}
});
And, finally, my server has the Meteor.methods
defined that return the config JSON object used to populate the form. As I mentioned, it works just fine in localhost.
When I open the deployed webpage and check the Chrome console, this is what I see:
So that makes me thing it could be some issue with my deployment configuration, more specifically regarding sticky sessions. But not really sure, and also not sure what I could change in my deployment script to fix that.
And, lastly, my Dockerfile for the GCloud deployment is:
FROM gcr.io/google_appengine/nodejs
RUN install_node v4.8.2
COPY . /app/
RUN (cd programs/server && npm install --unsafe-perm)
CMD node main.js
Any help will be much appreciated, thanks.
EDIT: Adding the getConfig method as requested:
Meteor.methods({
getConfig: function() {
return {
btcmBTCFee:btcm_btc_fee,
btcmBTCTransferFee:transfer_fee,
indyBTCFee:indy_btc_fee,
indyBTCTransferFee:transfer_fee,
coinjarBTCFee:coinjar_btc_fee,
coinjarBTCTransferFee:transfer_fee,
coinspotBTCFee:coinspot_btc_fee,
coinspotBTCTransferFee:transfer_fee,
russelBTCFee:coinspot_russel_btc_fee,
russelBTCTransferFee:transfer_fee,
acxBTCFee:acx_btc_fee,
acxBTCTransferFee:transfer_fee,
btcmLTCFee:btcm_ltc_fee,
btcmLTCTransferFee:transfer_fee,
indyLTCFee:indy_ltc_fee,
indyLTCTransferFee:transfer_fee,
coinspotLTCFee:coinspot_ltc_fee,
coinspotLTCTransferFee:transfer_fee,
russellLTCFee:coinspot_russel_ltc_fee,
russellLTCTransferFee:transfer_fee,
minimum_pct_for_alert:minimum_pct_for_alert,
minimum_variation_pct_to_send_alert:minimum_variation_pct_to_send_alert,
enable_send_alert:enable_send_alert,
send_to_email:send_to_email
};
}
});
It is an extremely simple function, it is just returning global variables. I am not even reading from MongoDB just yet.
EDIT2:
I actually forgot I have the app.yml file, the ROOT_URL is there, and also correct:
entrypoint: meteor run
env: flex
runtime: custom
env_variables:
ROOT_URL: https://<<url>>.appspot.com/
MONGO_URL: "mongodb://<<user>>:<<pw>>@ds157444.mlab.com:57444/arbot"
DISABLE_WEBSOCKETS: "1"
skip_files:
- ^(.*/)?\.dockerignore$
- ^(.*/)?\npm-debug.log$
- ^(.*/)?\yarn-error.log$
- ^(.*/)?\.git$
- ^(.*/)?\.hg$
- ^(.*/)?\.svn$
SOLUTION:
I got it to work!
I decided to change DISABLE_WEBSOCKETS: "1"
to DISABLE_WEBSOCKETS: "0"
and tada!! working!! :)
SOLUTION:
I got it to work! I decided to change DISABLE_WEBSOCKETS: "1" to DISABLE_WEBSOCKETS: "0" and tada!! working!! :)