These are chat archives for reactioncommerce/reaction

9th
May 2019
priyankaa02
@priyankaa02
May 09 06:20
error=request_forbidden&error_debug=No+CSRF+value+available+in+the+session+cookie&error_description=The+request+is+not+allowed&error_hint=You+are+not+allowed+to+perform+this+action
what can be the solution for this ?
silviuiacobivfuture
@silviuiacobivfuture
May 09 08:58
hey guys. question - how do I connect the starter kit to a remote reaction back end. the env file properties are a bit confusing.
any clues ? many thanks.
Loan Laux
@loan-laux
May 09 09:00
What exactly is unclear? I'd say just replace the GraphQL endpoint URLs in there, but that wouldn't help.
silviuiacobivfuture
@silviuiacobivfuture
May 09 09:08
Hy Loan.
ok - noob question :D
why EXTERNAL url and INTERNAL url
Loan Laux
@loan-laux
May 09 09:16
INTERNAL = within your network (VPC if on AWS)
EXTERNAL = accessible from the Internet
silviuiacobivfuture
@silviuiacobivfuture
May 09 09:18
oh
so basically the external one is the only required one in my case
Loan Laux
@loan-laux
May 09 09:21
Well, can you tell me more about your setup? Why wouldn't you need an internal URL?
Alexander Bach
@AlexanderBachSchmidt
May 09 09:26

Hey all! Completely new here, so apologies in advance for a few stupid questions. First time trying Docker as well as Reaction.

I went through the whole setup process for reaction-platform as written in the docs. I had a lot of trouble with it being completely inaccessible (really slow, so would just keep loading), but got it working in the end.

Then wanted to fork the starter-kit in order to make customizations. I cloned it locally into the reaction-platform directory, gave it another name and changed the remote origin to a private repo on GitHub. Starts fine using docker-compose up -d. The problem is that now, the make start will fail. Even though it seems the other containers are running, I cannot access the localhost URLs.

How should I handle this?

Loan Laux
@loan-laux
May 09 09:27
@AlexanderBachSchmidt Did you make sure to set your Docker memory allocation to > 4GB?
Alexander Bach
@AlexanderBachSchmidt
May 09 09:27
Yes, it's 6GB!
Loan Laux
@loan-laux
May 09 09:27
Okay, great. Which containers fail?
Alexander Bach
@AlexanderBachSchmidt
May 09 09:27
If I go into react-platform and run make start, it says
Starting reaction-hydra_postgres_1 ... done
Starting reaction-hydra_hydra-migrate_1 ... done
Starting reaction-hydra_hydra_1         ... done
Starting reaction_mongo_1 ... done
Starting reaction_reaction_1 ... done
/bin/sh: line 0: cd: reaction-next-starterkit: No such file or directory
make: *** [start-reaction-next-starterkit] Error 1
So I just leave it be and do cd demo-shop (name of cloned starter kit) then docker-compose up -d. They're then all running, but my browser doesn't load it
Loan Laux
@loan-laux
May 09 09:28
Hmm. Can you make init-reaction-next-starterkit?
Looks like the cloning of the starter-kit failed the first time for some reason. Let me know if you get an error with the command above.
Alexander Bach
@AlexanderBachSchmidt
May 09 09:29
It has nothing to do with the fact that I use my own cloned version that I renamed?
Seems to have worked
Successfully built 11d6b8b77de5
Successfully tagged reaction-next-starterkit_web:latest
Running post-build hook script for reaction-next-starterkit.
reaction-next-starterkit post-build script invoked.
Creating reaction-next-starterkit_web_1 ... done
Running post-project-start hook script for reaction-next-starterkit.
reaction-next-starterkit post-project-start script invoked.
Loan Laux
@loan-laux
May 09 09:30
Shouldn't be a problem. You need to run a successful make init first, and then change your git remote URLs in whatever subdirectory you wish to.
So if you have your own fork of the starter-kit, cd into it right now and do your git remote set-url <whatever>
Alexander Bach
@AlexanderBachSchmidt
May 09 09:31
Okay, so basically I need to remove the repo I made before. Then go into the startkit directory and change git remote?
Loan Laux
@loan-laux
May 09 09:32
No, you don't have to remove your previous repo. The makefile pulled Reaction's latest one, and now you just change your origin remote in there to pull yours instead (and you keep Reaction's as upstream if needed).
Or am I missing something about your setup?
Alexander Bach
@AlexanderBachSchmidt
May 09 09:33
I know have two starter-kit directories inside of react-platform
Loan Laux
@loan-laux
May 09 09:34
What... How?
Alexander Bach
@AlexanderBachSchmidt
May 09 09:34
demo-shop (cloned, renamed, changed git origin) and the reaction-next-starterkit from the Makefile
Okay now it actually loads!
Wow
Loan Laux
@loan-laux
May 09 09:35
Ah, okay. Let me clarify. You don't add or rename any directory inside of reaction-platform. You simply go in the pre-created reaction-next-starterkit and make your changes there.
Alexander Bach
@AlexanderBachSchmidt
May 09 09:35
Ahh thought I had to change the git remote so my customizations were not overwrited
Loan Laux
@loan-laux
May 09 09:35
The makefile is made to work with the default directories: reaction, reaction-hydra and reaction-next-starterkit. If you add new directories in there, they'll be ignored. Hope this clarifies things!
priyankaa02
@priyankaa02
May 09 09:35
hi all... I am running reaction commerce to the remote server and I changed all localhost to the server's ip..everything is running fine but when I am trying to logging or register , it shows error=request_forbidden&error_debug=No+CSRF+value+available+in+the+session+cookie&error_description=The+request+is+not+allowed&error_hint=You+are+not+allowed+to+perform+this+action but if I remain hydra url's to the localhost then it works fine but localhost of remote server can't be access at my local server
Alexander Bach
@AlexanderBachSchmidt
May 09 09:35
So now I have the standard react-platform setup. What's the way too go from here?
Makes sense! And thanks A LOT for helping out
Loan Laux
@loan-laux
May 09 09:36
Well, the way to go from there... That depends very much on where you want to go. :)
Alexander Bach
@AlexanderBachSchmidt
May 09 09:37
Haha you're right! I mean in terms of handling the different repos etc. I mean -- basically I would want them on my own GitHub - to save my customizations
Loan Laux
@loan-laux
May 09 09:37
Sorry, that was a good occasion to sneak in a movie reference.
So, since you already have your own storefront repo, cd into reaction-next-starterkit and change your origin URL. Then pull whatever branch you want and you'll have your previously saved modifications in place.
I would personally keep Reaction's remote as an upstream to merge in future changes, but you could also not care about that at all.
@priyankaa02 Can you please give some more context? Maybe a screenshot?
Alexander Bach
@AlexanderBachSchmidt
May 09 09:40
Did method 2 here and now see it in my own repo: https://docs.reactioncommerce.com/docs/swag-shop-2
priyankaa02
@priyankaa02
May 09 09:40
@loan-laux yes
Alexander Bach
@AlexanderBachSchmidt
May 09 09:40
So can I get the upstream changes that way?
Loan Laux
@loan-laux
May 09 09:41
Yup, that's exactly the way. I prefer to use upstream instead of rcmain as it's more generic, but it's up to you!
Alexander Bach
@AlexanderBachSchmidt
May 09 09:42
Got you!
Is the starter-kit the only repo I actually want too do this on?
I should do the same for reaction right?
Loan Laux
@loan-laux
May 09 09:42
If you plan to make changes to the backend (which I imagine is the case), then yes. No point in doing it for Hydra though.
Alexander Bach
@AlexanderBachSchmidt
May 09 09:43
Makes sense!
priyankaa02
@priyankaa02
May 09 09:43
how can I attach picture here? I don't see any option here to attach anyhing
Please help
Loan Laux
@loan-laux
May 09 09:44
No idea @priyankaa02, I usually just drag-n-drop them.
priyankaa02
@priyankaa02
May 09 09:46
when I change localhost to server ip then it comes with error
I mean it is working fine with localhost but reaction commerce is running on remote server
localhost can't be access on my local system
Loan Laux
@loan-laux
May 09 09:48
Looks like you didn't update your domain everywhere. Check all your env variables, on the backend, the storefront and Hydra.
silviuiacobivfuture
@silviuiacobivfuture
May 09 09:48
@loan-laux sorry it took so long.
So I did play around with deploying reaction in a kubernetes cluster via jenkins. Works quite ok. Reaction builds fine, server starts correctly in a Pod inside the cluster, and I can access the admin from a public ingress address, with a tk domain attached.
So far so good. I made a separate deployment in a separate namespace for dev purposes. Again, works fine.
Now I simply want to connect the reaction next starterkit to it from my localhost, or from anywhere else actually :D
And because Im a huuuuuge DOcker newb, I don't quite understand the internal networking stuff :(
priyankaa02
@priyankaa02
May 09 09:49
I had updated localhost by domain name in every folder(reaction,reaction-hydra,reaction-next-starterkit)
@loan-laux what about these values in .env files hydra.auth.reaction.localhost ?
I mean localhost should be replaced by domain in these values too ?
priyankaa02
@priyankaa02
May 09 09:55
there are some values in .env file like these OAUTH2_HOST=hydra.auth.reaction.localhost
OAUTH2_IDP_HOST_URL=http://reaction.api.reaction.localhost:3000/
Loan Laux
@loan-laux
May 09 09:55
@silviuiacobivfuture Simple: your backend's internal URL is whatever domain or IP that points to your backend nodes. Typically, in production, it'll be your backend's load balancer's internal IP/DNS, because you'll have multiple backend nodes.
priyankaa02
@priyankaa02
May 09 09:55
so localhost should be renamed by domain name in these values too ?
Loan Laux
@loan-laux
May 09 09:56
@silviuiacobivfuture Sorry I should've added: whatever domain or IP that points to your backend containers within your Kubernetes cluster. I believe you can set a hostname for them, right?
@priyankaa02 What environment are you deploying this architecture on? AWS ECS?
priyankaa02
@priyankaa02
May 09 09:58
digital ocean
jm18457
@jm18457
May 09 10:43
Hello. I created a reactioncommerce/reaction#5171, but it fails snyk-security build and test phase. The error I receive is snyk test requires an authenticated account. Please runsnyk authand try again. which looks like a configuration problem and not a problem with my code. Are there any steps I missed?
Loan Laux
@loan-laux
May 09 10:51
Yeah that's a recurrent issue for contributors who aren't in the Reaction org @jm18457. I guess wait for a member of the core team to chime in there.
Other than that, I have to say: thanks for this much needed PR!
jm18457
@jm18457
May 09 10:54
@loan-laux Ok, ty
silviuiacobivfuture
@silviuiacobivfuture
May 09 11:13
@loan-laux thanks for taking the time to answer.
The answer is yes - I actually create subdomains for every deployment. So its basically a provisioning system. I have a dashboard where I add certain params (ie : mongo user, reaction default admin user, store name, replica sets, and other "business info"). I then call and endpoint I wrote that triggers the Jenkins build, passing the parameters to the build pipeline. After building the image (if requested), it gets stored in an image repo (suing kubernetes for this as well), and then I simploy use kubectl to deploy it. I also create subdomains in the form of $client.api.$ivprov.com for server, $client.storefront.$ivprov.com. The build tool builds the storefront separately, after building the meteor app. Ingress controllers start for both. So I do have access to the ingress LB from the outside.
Are yo saying that the EXTERNAL_GRAPHQL_URL property in the env for the storefront should point to the public meteor app service instance ?
Loan Laux
@loan-laux
May 09 11:17
Yup, exactly
silviuiacobivfuture
@silviuiacobivfuture
May 09 11:22
CANONICAL_URL should be the domain where the app lives I guess
Loan Laux
@loan-laux
May 09 11:22
Indeed
silviuiacobivfuture
@silviuiacobivfuture
May 09 11:22
as for INTERNAL_GRAPHQL_URL
I guess it needs to be the internal network in the cluster (bound by namespace)
Loan Laux
@loan-laux
May 09 11:23
A URL or IP that points to your API containers from within your Kubernetes cluster, not accessible from outside
silviuiacobivfuture
@silviuiacobivfuture
May 09 11:23
XD so i got it
Loan Laux
@loan-laux
May 09 11:23
Yup :+1:
silviuiacobivfuture
@silviuiacobivfuture
May 09 11:23
Thanks a lot.
Vadym Vorobel
@vadym-vorobel
May 09 15:04

Hello! I have a question about how to implement a free shipping after X amount feature. Is there a ready solution for that? Or maybe someone faced with the same problem?
I found the same question in this chat, but I see that it wasn't answered:

Using shippo plugin, does it support having free shipping after X amount, or is that something I would need to develop (I am new to the project and gitter, so sorry if the wrong channel)

Any thoughts? Thanks for help!

Loan Laux
@loan-laux
May 09 16:46
@vadym-vorobel I'd say fork the flat rate plugin and implement the change. In the getFulfillmentMethodsWithQuotes function, you get the commonOrder object in which you have the total price of the order.
Eliot Hills
@elhil
May 09 18:43
hm, has anyone run into an issue where apollo server won’t start, even though reaction has started? I’m up to date with develop
Eliot Hills
@elhil
May 09 19:02
ah, I hadn’t added the env variables from this PR: reactioncommerce/reaction#5055