@8base-js-sdk/api Subscribe to Child Environment

When using @8base-js-sdk/api (v0.1.6) from npm, when initializing a subscription to a workspaceId that corresponds to a child environment of the Master environment, it causes the subscription to error out saying “Workspace not found”. However, when using the Master workspaceId, the subscription works fine.

An example of what I mean when I say the workspaceId being a child environment would be where envr123 is the Master environment; a child environment would be envr123_Development or envr123_Staging.

I’m not sure if this is the intended behavior or not, but I would hope it’s not. To strictly only allow GraphQL subscriptions on the Master environment would be a huge flaw and a real deal breaker for any application that makes use of multiple database environments for the purposes of development or staging environments that don’t affect production data.

If there is anything I’m simply missing please let me know because we would really like to make use of this package if possible.


This same problem can be found on multiple other community posts as well. The first example there seemed to be no resolution for, however, the other 2 seem to be resolved by defining an environmentName to identify the child environment. This concept does not seem to exist on this @8base-js-sdk/api package (I also looked at the typescript file to see for sure what properties are acceptable and saw nothing of the sort)

Nice catch here, thanks for pointing out the problem. I’m opening a support ticket for it!

@sebastian.scholl Awesome, thank you! If possible, could you please keep me posted on where that goes so I can know on my end when I’m good resume development with that functionality?

Yeah! I submitted this community post with that support ticket so we should keep you updated.

Any updates on this?

none yet. I honestly would avoid using the JS SDK for the time being as it’s not being actively maintained and subscriptions work well using normal graphql clients or the Websocket API directly.

Ok. Any suggestions/recommendations on how we can create a subscription to 8base without using Apollo? We’ve looked at graphql-ws and socket.io and haven’t had any luck with either of them even though those are the most popular. I see plenty of websocket specific libraries available to use, but seemingly very little that actually support graphql subscriptions with them

@Fomich do you have a good code sample from the team for setting up a subscription client without the SDK?

You can use this snippet:

 new WebSocketLink({
      uri: process.env.WSS_URL,
      options: {
        connectionParams: () => {
          return {
            // token: st.token,
            workspaceId: 'WS_ID',
      webSocketImpl: class WebSocketWithoutProtocol extends WebSocket {  
        constructor(url: string) {
          super(url); // ignore protocol

Check this out for more info too Subscriptions with Vue Apollo Next

And here are the few refs from apollo and hasura:

Set up GraphQL Subscriptions using Apollo Client | GraphQL Vue 3 Apollo Tutorial

Unfortunately that sample doesn’t quite help what we’re looking for. The code snippet itself appears to have the same problem as the SDK where it’s not able to target a specific 8base child environment. It accepts the workspace id, but the workspace id is the same across the master and child environments so I’d really need a way to target the child specifically.

Additionally, we’d like to achieve this without using Apollo as it won’t work well with our application. We may just have to not use subscriptions I suppose.