These are chat archives for reactioncommerce/reaction

27th
Apr 2016
Aaron Judd
@aaronjudd
Apr 27 2016 00:00
you should be, but it does need to be in the Shops domains array then. This was to allow for multiple host names in a multi-shop scenario. If you’re running as a single shop, localhost might work. I guess what we probably need is a clear logging error in this regard… (that’s one of the possible causes for getShopID to legitimately fail).
Spencer Norman
@spencern
Apr 27 2016 00:01
ok, so I need to add it to the sampleData package?
to provision the server at least
looks like the sampleData is resetting the array of domains every time I restart my server, so that appears to be the culprit.
glad it wasn’t something bigger
Spencer Norman
@spencern
Apr 27 2016 00:08
can’t find the domains field anywhere in the sample data
Aaron Judd
@aaronjudd
Apr 27 2016 00:09

it’s inserting localhost as a schema default I think. it’s ok to edit the Shops in reaction-sample-data, add to the domains and remove the second <blank site> shop. You can also not use that package and just load things easily (see the load.js in reaction-sample-data).

  ReactionImport.fixture().process(Assets.getText("data/Shops.json"), ["name"], ReactionImport.shop);
  ReactionImport.flush(Shops);

( used within a hook, see https://github.com/reactioncommerce/reaction/blob/development/packages/reaction-sample-data/server/load.js)

Spencer Norman
@spencern
Apr 27 2016 00:11
  getDomain: function () {
    let absoluteUrl = Meteor.absoluteUrl();
    if (typeof absoluteUrl === "string") {
      return absoluteUrl.split("/")[2].split(":")[0];
    }
    return "localhost";
  },
what is this doing?

that appears to be working, still not really sure why it’s failing honestly, but if it’s as easy as just adding a doming to our db and then removing or changing the sample data, that’s fine by me

edit: nevermind, completely understand the getDomain function

Aaron Judd
@aaronjudd
Apr 27 2016 00:13
// initialize shop registry when a new shop is added
Shops.find().observe({
  added(doc) {
    ReactionRegistry.setShopName(doc);
    ReactionRegistry.setDomain();
  },
  removed() {
    // TODO SHOP REMOVAL CLEANUP FOR #357
  }
});
It looks like this should be triggering an error from ReactionRegistry.setDomain, when the Logger.error("Failed to determine default shop.", _error) is thrown. I’m thinking something about the timing of the events is also off a bit, that some of this logic used to catch the scenario where it was an initial data load and the ROOT_URL didn’t match localhost.
but, yes, the easy answer it to set it in the default data (if that works).
Spencer Norman
@spencern
Apr 27 2016 00:20
building the tarball now, and will report back
Spencer Norman
@spencern
Apr 27 2016 00:30

:+1: Adding

“domains": ["my.domain.com”],

to the shops sample data works

actually, spoke to soon
damn, restarted the server, and I’m seeing the same issue
my domain was reset to localhost on server restart
I’m gonna go grab some :beers: and figure this one out later
Aaron Judd
@aaronjudd
Apr 27 2016 00:39
:fork_and_knife: :thumbsup:
xiaoc li
@brianxcli
Apr 27 2016 01:26
Hi, how can I build the project, or what to add to run Reaction under pure express runtime, like Amazon Web Service?
Brent Hoover
@zenweasel
Apr 27 2016 03:23
Not sure what you mean
by “pure express runtime"
when you do meteor build you are essentially building a node app that can be hosted like any other node app
xiaoc li
@brianxcli
Apr 27 2016 04:27
I tried using AWS, the error said that the project has lost an app.js or package.json. After manually adding those two, the log shows it cannot find 'fibers' module.
Brent Hoover
@zenweasel
Apr 27 2016 04:54
It builds a node app, but not an express app. I think app.js is an Express convention
xiaoc li
@brianxcli
Apr 27 2016 08:58
Hi, any idea of why I cannot connect to mongo when starting Reaction docker container. I am running mongo properly and can connect to it using mongo tool
blob
I can get the content using curl
blob
Brent Hoover
@zenweasel
Apr 27 2016 10:00
This message was deleted
Spencer Norman
@spencern
Apr 27 2016 19:00
@aaronjudd, still haven’t ID’d the issue causing the domain to get reset to localhost but I did find that I needed to run npm install --unsafe-perm to install react on any server I had where I was logged in as root
in the bundle/programs/server directory that is
Aaron Judd
@aaronjudd
Apr 27 2016 20:04
@spencern :thumbsup:
Spencer Norman
@spencern
Apr 27 2016 20:55
@aaronjudd the issue turns out to be the defaultValue set on domains in the Shops.js schema
this is getting reset to the defaultValue every time I restart my server, regardless of what the existing value is
I’ve confirmed this by adding additional values and restarting the server
not sure why that’s happening, but worth knowing
if I add my domain to the default value array (or replace localhost), I can restart the server at will.
again, not sure why this is just now popping up, I was able to restart just fine pre-Meteor 1.3