These are chat archives for reactioncommerce/reaction

4th
Feb 2019
noodle
@noodle-t
Feb 04 05:29
Does anyone know if the /graphiql route was removed in 2.0.0-rc.9?
noodle
@noodle-t
Feb 04 06:13
To answer my own question, in case anyone else hit this, rc9 provides Apollo playground, which can be found on the route : /graph-alpha
Gabriel Lumbi
@Lumbi
Feb 04 06:26

Hey, I'm writing a plugin that automatically imports and publishes products from a JSON file. At first I simply wanted to import the product afterCoreInit but the context at that point doesn't have any user and the Meteor method to publish a product requires permission.

So, instead of doing the import at start-up I thought the plugin should then maybe expose a route and be called from the client's side. But I'm having trouble finding documentation on how to do that. The route I've setup now just returns 404.

Does anyone know how to do this kind of plugin?

Loan Laux
@loan-laux
Feb 04 07:34
@bij-fts Would building your own OAuth service be okay?
Loan Laux
@loan-laux
Feb 04 07:41
@Lumbi Have you tried using the default Reaction fixture importer? (i.e. putting your JSON file in /private/data/Products.json and starting up Reaction with an empty product collection)
Gabriel Lumbi
@Lumbi
Feb 04 08:10
@loan-laux My integration needs to be able to import the products periodically so manually adding products there doesn't work for me.
Loan Laux
@loan-laux
Feb 04 08:10
Gotcha. Then you'd be looking at replicating some of the behavior from the Shopify connector. Have you looked at it yet?
Gabriel Lumbi
@Lumbi
Feb 04 08:15
@loan-laux yep, I checked it out. I guess yes it would be the same thing. Though I don't really need any UI. Seems like most plugin rely on some UI to call the a backend functionality. I was hoping to be able to have the server expose some endpoint to start the import and connect to a 3rd party service.
Loan Laux
@loan-laux
Feb 04 08:16
Well I worked on similar plugins for clients. Not really an issue. All you need is to declare a route, skip the control panel UI stuff and call your import function from the endpoint responder. Can I take a look at your register.js so I can get an idea of why your route isn't working?
Gabriel Lumbi
@Lumbi
Feb 04 08:17
@loan-laux
Reaction.registerPackage({
  label: "Temporary importer of products for Reaction Commerce",
  name: "temp-product-importer",
  autoEnable: true,
  registry: [{
    route: "/import-products",
    name: "import-products"
  }]
});
there ya go
And I have in client/index.js
Router.Hooks.onEnter("import-products", () => {
  Logger.info("Calling temp/importProducts")
  Meteor.call("temp/importProducts")
});
Loan Laux
@loan-laux
Feb 04 08:19
Yeah, that's what I thought. The way I would go about isn't actually to define a route inside register.js, but to use Reaction.Endpoints.add to register the endpoint from your init.js.
Gabriel Lumbi
@Lumbi
Feb 04 08:19
:0
I see, let me try
Loan Laux
@loan-laux
Feb 04 08:20
The routes in register.js are really for serving pages more than anything else. If you want to add REST endpoints, Reaction.Endpoints.add is the way to go.
Gabriel Lumbi
@Lumbi
Feb 04 08:20
got it
Loan Laux
@loan-laux
Feb 04 08:20
(and it's way quicker/easier)
Gabriel Lumbi
@Lumbi
Feb 04 08:20
@loan-laux does this init.js have a special meaning to Reaction or Meteor?
or can it be just in the index.js ?
Wow, I wish I had found this earlier http://api.docs.reactioncommerce.com/Endpoints.html
Loan Laux
@loan-laux
Feb 04 08:22
I would put it in its own JavaScript file and import it from index.js after ./init.js (if you have one).
init.js doesn't really have a special meaning. It's just a healthy way to separate stuff that gets ran first and the rest. But you could import this endpoint file from init.js if you wanted to.
Gabriel Lumbi
@Lumbi
Feb 04 08:23
OK cool
Loan Laux
@loan-laux
Feb 04 08:23
Usually, you'll try and put only stuff that's critical in init.js. Like schema overrides and fixture imports.
Gabriel Lumbi
@Lumbi
Feb 04 08:38
OK nice the endpoint is working
Loan Laux
@loan-laux
Feb 04 08:38
:+1:
aktywnitu
@aktywnitu
Feb 04 10:24
Hi,
can sombody tell me what is the reason of this error during running Reaction ecommerce?
""Unable to access the GraphQL API. Is it running and accessible at http://reaction.api.reaction.localhost:3000/graphql-alpha from the Storefront UI server?""
All ocker containter are up properly:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES a289ed1b02b9 reaction-next-starterkit_web "/usr/local/src/reac…" 26 hours ago Up 25 seconds 0.0.0.0:4000->4000/tcp reaction-next-starterkit_web_1 6287e1447ca5 reaction_reaction "bash -c 'meteor npm…" 26 hours ago Up 28 seconds 0.0.0.0:3000->3000/tcp reaction_reaction_1 029ea8398682 mongo:3.6.3 "docker-entrypoint.s…" 26 hours ago Up 29 seconds 0.0.0.0:27017->27017/tcp reaction_mongo_1 724d497c45ba oryd/hydra:v1.0.0-beta.9-alpine "hydra serve all --d…" 26 hours ago Up 30 seconds 0.0.0.0:4444-4445->4444-4445/tcp, 0.0.0.0:5555->5555/tcp reaction-hydra_hydra_1 9fe225141245 postgres:10.3 "docker-entrypoint.s…" 26 hours ago Up 31 seconds 0.0.0.0:32773->5432/tcp reaction-hydra_postgres_1
Loan Laux
@loan-laux
Feb 04 10:24
@aktywnitu Anything strange in the logs for reaction_reaction_1?
aktywnitu
@aktywnitu
Feb 04 10:27
reaction_1 | Error: App failed to start
Loan Laux
@loan-laux
Feb 04 10:28
Okay, can you send more about this?
aktywnitu
@aktywnitu
Feb 04 10:30
reaction_1 | npm WARN apollo-cache-inmemory@1.2.5 requires a peer of graphql@0.11.7 || ^0.12.0 || ^0.13.0 but none is installed. You must install peer dependencies yourself.
reaction_1 | npm WARN apollo-client@2.3.5 requires a peer of graphql@^0.11.0 || ^0.12.0 || ^0.13.0 but none is installed. You must install peer dependencies yourself.
reaction_1 | npm WARN apollo-link@1.2.2 requires a peer of graphql@^0.11.3 || ^0.12.3 || ^0.13.0 but none is installed. You must install peer dependencies yourself.
reaction_1 | npm WARN apollo-link-http@1.5.4 requires a peer of graphql@^0.11.0 || ^0.12.0 || ^0.13.0 but none is installed. You must install peer dependencies yourself.
reaction_1 | npm WARN apollo-link-http-common@0.2.4 requires a peer of graphql@^0.11.0 || ^0.12.0 || ^0.13.0 but none is installed. You must install peer dependencies yourself.
reaction_1 | npm WARN graphql-iso-date@3.5.0 requires a peer of graphql@^0.5.0 || ^0.6.0 || ^0.7.0 || ^0.8.0-b || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 but none is installed. You must install peer dependencies yourself.
reaction_1 | npm WARN graphql-relay@0.5.5 requires a peer of graphql@^0.5.0 || ^0.6.0 || ^0.7.0 || ^0.8.0-b || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 but none is installed. You must install peer dependencies yourself.
reaction_1 | npm WARN graphql-tag@2.9.2 requires a peer of graphql@^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 but none is installed. You must install peer dependencies yourself.
reaction_1 | npm WARN react-addons-test-utils@15.6.2 requires a peer of react-dom@^15.4.2 but none is installed. You must install peer dependencies yourself.
reaction_1 | npm WARN react-taco-table@0.5.1 requires a peer of react@^15.3 but none is installed. You must install peer dependencies yourself.
reaction_1 | npm WARN react-taco-table@0.5.1 requires a peer of react-dom@^15.3 but none is installed. You must install peer dependencies yourself.
reaction_1 | npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules/fsevents):
reaction_1 | npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
reaction_1 |
reaction_1 | audited 30642 packages in 44.436s
reaction_1 | found 0 vulnerabilities
reaction_1 |
reaction_1 | MongoDB replica set initialized and ready.
reaction_1 | Setting up plugin imports...
reaction_1 |
reaction_1 | Setting up style imports...
reaction_1 |
reaction_1 | Provisioning assets...
reaction_1 |
reaction_1 | [[[[[ /opt/reaction/src ]]]]]
reaction_1 |
reaction_1 | => Started proxy.
reaction_1 | => A patch (Meteor 1.8.0.2) for your current release is available!
reaction_1 | Update this project now with 'meteor update --patch'.
reaction_1 | Killed
reaction_1 | { Error: Command failed: meteor --raw-logs
reaction_1 | at checkExecSyncError (child_process.js:601:13)
reaction_1 | at execSync (child_process.js:641:13)
reaction_1 | at _callee$ (/usr/local/lib/node_modules/reaction-cli/dist/commands/run.js:72:43)
reaction_1 | at tryCatch (/usr/local/lib/node_modules/reaction-cli/node_modules/regenerator-runtime/runtime.js:65:40)
reaction_1 | at Generator.invoke [as _invoke] (/usr/local/lib/node_modules/reaction-cli/node_modules/regenerator-runtime/runtime.js:303:22)
reaction_1 | at Generator.prototype.(anonymous function) [as next] (/usr/local/lib/node_modules/reaction-cli/node_modules/regenerator-runtime/runtime.js:117:21)
reaction_1 | at step (/usr/local/lib/node_modules/reaction-cli/dist/commands/run.js:98:191)
reaction_1 | at /usr/local/lib/node_modules/reaction-cli/dist/commands/run.js:98:361
reaction_1 | at <anonymous>
reaction_1 | at process._tickCallback (internal/process/next_tick.js:188:7)
reaction_1 | error: null,
reaction_1 | cmd: 'meteor --raw-logs',
reaction_1 | file: '/bin/sh',
reaction_1 | args: [ '/bin/sh', '-c', 'meteor --raw-logs' ],
reaction_1 | options:
reaction_1 | { stdio: [ [Object], [Obje
Maby I need install manualy graphql? Is it not installed automatically?
aktywnitu
@aktywnitu
Feb 04 11:11
I see similar problem here. I will test solution:
reactioncommerce/reaction#4765
aktywnitu
@aktywnitu
Feb 04 11:18
VPS has only 2GB RAM, so probably it is the reason.
Loan Laux
@loan-laux
Feb 04 11:19
Sorry I was AFK for a bit. Yes, I would definitely look into that before anything else. Hope you solve it quickly. :+1:
Karbal
@karbal
Feb 04 11:22
Hello @loan-laux
I want to use Graphql as a mobile database, but I have conceded.
What is Query to get back the list of products so categories
Small advice I am a developer full stack but worked a lot with javascript, it would be necessary to see with your team to use typescript
Loan Laux
@loan-laux
Feb 04 11:51
@karbal Check out catalogItems in the GraphQL API docs. https://docs.reactioncommerce.com/docs/graphql-api
aktywnitu
@aktywnitu
Feb 04 12:02
@loan-laux , Reaction commerce is still in experimental project for me.
I don't know if it will be suitable for my needs.
How much is memory usage one Reaction project instance.
I see that it requires minimal 2GB for installation.
Reaction now has old and new UI version and in the future Reaction are planning no use meteor.
How can it improve memory consumption, compilation time and page refreshing time?
Are you have some plan to optimize project and make it more friendly for developers / users?
Loan Laux
@loan-laux
Feb 04 12:36
@aktywnitu I'm not part of the Reaction core team but I'll try my best to answer. The new Next.js storefront should cause no issues in terms of build times and memory consumption. Do you have any issue with it on your end? With this new storefront, you shouldn't need to work on the old storefront at all, making almost all of your rebuild time problems disappear. The only exception to that is when working on back-end plugins and when customizing the admin interface, which I suppose you'd be doing way less often than working on the storefront.
Karbal
@karbal
Feb 04 12:41

@loan-laux I tried your query catalogItems I failed to retrieve the list of products
can you write me exactly a query to retrieve the products

{
primaryShopId
catalogItems(shopIds: "cmVhY3Rpb24vc2hvcDpKOEJocTN1VHRkZ3daeDNyeg==") {

edges {
  cursor
  node {
    shop{
      tags{
        nodes{name}
      }
    }
  }
}
totalCount

}
}

Loan Laux
@loan-laux
Feb 04 12:41
I believe shopIds has to be an array of strings, @karbal
aktywnitu
@aktywnitu
Feb 04 12:54
@loan-laux Thanks for answer. I will try run it in my local machine and make some perfomance tests.
Karbal
@karbal
Feb 04 13:25
@loan-laux So there is not a query to retrieve the product listings;
nevertheless, it is something that initial has to do
Loan Laux
@loan-laux
Feb 04 13:45
@karbal The catalogItems query does retrieve products, as explained in the documentation. Are you still having trouble using it?
Karbal
@karbal
Feb 04 14:36
@loan-laux first I thank you for answering my questions,
No, I have not managed to get back the list of products