-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
type safety in multiple environments #299
Comments
This is tricky, because multiple schemas/environments really isn't something Relay was designed for. My boring answer is going to be "don't do it". Is there any way you could stitch together everything under a single API? Just a slim service that stitches the schemas and delegates the resolution. This question comes up from time to time, but unfortunately there's simply no good answer to it. |
Making two APIs into a single one would be always the best solution. But, it has some circumstances not to make it. I came up with the idea to make |
I think that could work, but again, this is probably going to be very painful to maintain down the road 😃 Here's an issue on the Relay tracker about the same thing: facebook/relay#3153 Just to reiterate (I know I already said this, and I'm sure you have your reasons this cannot work for you) - If I was in the situation where I needed to query two separate APIs in the same app, I'd spend my time implementing a thin thin proxy backend that stitches the services together via schema stitching. Even if that is cumbersome (having to build and deploy another service), I strongly believe it'll be much less painful over time than the alternative. I'm assuming you might start running into naming conflicts at some point too, at which point concatenation of the schemas won't work. Anyway, I'm interested in hearing how this works out for you. Keep us posted! |
@mattdamon108 I'm going to close this one for now since there's nothing to be done from the RescriptRelay side, but please feel free to add your comments to this issue about how this works out for you, so others in the same situation can benefit. |
Hi, always appreciate your efforts and works!
I'm facing to have multiple environments which means multiple API endpoints. AFAIK, we can not have multiple schema files for relay config. Hence I'm gonna merge the multiple SDLs into a single schema file. At this point, I think we might have a runtime error, in case I write up the query, but if the closest relay context provider's environment doesn't work with that schema.
I think we can define this multiple environment case as a runtime issue, but is there any better way to handle it?
The text was updated successfully, but these errors were encountered: