Meteor/Apollo not running on production/Galaxy


#1

I’ve tried running a fairly bare-bones Apollo-server on Galaxy, everything works on local development. Turns out, that GraphIQL no longer works with the --production flag. Does anyone know why and how to resolve the issue?

GraphIQL gives me:

The script has an unsupported MIME type ('text/html').

The error msg above was due to a serviceworker, remove the sw and doesn’t appear anymore.
GraphiQL still shows nothing, with no error messages at all though. Just a blank page (dependencies are being loaded though)

/edit

what I noticed is that Meteor doesn’t load the react js and css in production
I don’t have a client folder and there’s basically nothing aside from the server import to initialize apollo server.

/edit

// default server configuration object                                                                                // 14
var defaultServerConfig = {                                                                                           // 15
  // graphql endpoint                                                                                                 // 16
  path: '/graphql',                                                                                                   // 17
  // additional Express server configuration (enable CORS there for instance)                                         // 18
  configServer: function (graphQLServer) {},                                                                          // 19
  // enable GraphiQL only in development mode                                                                         // 20
  graphiql: Meteor.isDevelopment,                                                                                     // 21
  // GraphiQL endpoint                                                                                                // 22
  graphiqlPath: '/graphiql',                                                                                          // 23
  // GraphiQL options (default: log the current user in your request)                                                 // 24
  graphiqlOptions: {                                                                                                  // 25
    passHeader: "'meteor-login-token': localStorage['Meteor.loginToken']"                                             // 26
  }                                                                                                                   // 25
}; // default graphql options to enhance the graphQLExpress server                                                    // 15
      

I guess this is the intended behavior. Probably since as you said, securing GraphiQL might be challenging.


#2

Would be nice to hear the solution to this. But how did you declare your graphql API as private? How would you ensure that graphiql couldn’t be accessible to just anyone in production?


#3

@AndreasGalster While in production, did you try to run a graphiql url in something like Postman (https://www.getpostman.com/) to see if it gets rejected or returns data?


#4

I see similar erroneous messages when I switch from one test project to another. Usually when one has a service worker, and the next does not. I’m not sure if your issue is related, but try clearing out all site data in the Application tab of your Chrome dev tools.