When trying to open a subscription, I get the following error:
{
"message": "Your subscription url is a websocket url, so your server must support graphql-ws or subscriptions-transport-ws protocol. If your server supports HTTP multipart subscriptions, change your subscription url to HTTP."
}
My server does support multipart subscriptions. But, when I go to the configuration to try and edit the subscription URL, it is not editable.
Is there a setting somewhere that I need to change to enable editing? I’m using the ApolloServerPluginLandingPageLocalDefault
plugin. Thanks!
Finally got it to work:
Set endpointIsEditable
to true
.
import { ApolloServerPluginDrainHttpServer } from '@apollo/server/plugin/drainHttpServer';
import { ApolloServerPluginLandingPageLocalDefault, ApolloServerPluginLandingPageProductionDefault } from '@apollo/server/plugin/landingPage/default';
// Set up ApolloServer.
const server = new ApolloServer({
schema,
// Disable introspection/sandbox for production
introspection: process.env.NODE_ENV !== 'production',
plugins: [
// Shutdown for the HTTP server.
ApolloServerPluginDrainHttpServer({ httpServer }),
// Shutdown for the WebSocket server.
{
async serverWillStart() {
return {
async drainServer() {
await serverCleanup.dispose();
},
};
},
},
// Landing Page and enable endpoint editing
process.env.NODE_ENV === 'production'
? ApolloServerPluginLandingPageProductionDefault()
: ApolloServerPluginLandingPageLocalDefault({
footer: false,
embed: {
endpointIsEditable: true
}
}),
],
});