Parse 4.2 startup error Must Provide Source. Received: undefined

I am upgrading from Parse Server 3.10 to 4.2 and I am getting the following error:

XXXXXXX/node_modules/graphql/jsutils/devAssert.js:13
    throw new Error(message);
    ^

Error: Must provide Source. Received: undefined.
    at devAssert (XXXXXXXXX/node_modules/graphql/jsutils/devAssert.js:13:11)
    at new Parser (XXXXXXXXX/node_modules/graphql/language/parser.js:80:67)
    at Object.parse (XXXXXXXXX/node_modules/graphql/language/parser.js:35:16)
    at Object.<anonymous> (XXXXXXXXX/node_modules/graphql-tools/dist/stitching/introspectSchema.js:39:42)
    at Module._compile (internal/modules/cjs/loader.js:959:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
    at Module.load (internal/modules/cjs/loader.js:815:32)
    at Function.Module._load (internal/modules/cjs/loader.js:727:14)
    at Module.require (internal/modules/cjs/loader.js:852:19)
    at require (internal/modules/cjs/helpers.js:74:18)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Anyone have any ideas how to fix it?

Could you please share the code that you are using to initialize the Parse Server?

Hi @davimacedo, here is the code

// Create the Parse Server API
const api = new ParseServer({
  databaseURI: databaseUri || defaultDatabaseUri,
  cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
  appId: process.env.APP_ID || 'XXXXXXXXXXXX',
  masterKey: process.env.MASTER_KEY || 'XXXXXXXXXXXX', // Add your master key here. Keep it secret!
  serverURL: process.env.SERVER_URL || 'http://localhost:1337/parse', // Don't forget to change to https if needed
  allowClientClassCreation: false,
  enableAnonymousUsers: false, // default is true, we may want this.
  verifyUserEmails: true,
  publicServerURL: `${publicServerURL}${mountPath}` || 'https://api.mydomain.com/1',
  preventLoginWithUnverifiedEmail: false,
  appName: 'XXXXXXXXX',
  // sessionLength: 31536000, // 1 year, default value
  // emailVerifyTokenValidityDuration: undefined, // default
  revokeSessionOnPasswordReset: true,
  emailAdapter: PostmarkAdapter({
    apiKey: process.env.POSTMARK_API,
    fromAddress: process.env.POSTMARK_FROM_ADDRESS,
  }),
  accountLockout: {
    duration: 5, // duration policy setting determines the number of minutes that a locked-out account remains locked out before automatically becoming unlocked. Set it to a value greater than 0 and less than 100000.
    threshold: 3, // threshold policy setting determines the number of failed sign-in attempts that will cause a user account to be locked. Set it to an integer value greater than 0 and less than 1000.
  },
  customPages: {
    invalidLink: `${publicServerURL}/public/invalid.html`,
    choosePassword: `${publicServerURL}/public/change_password.html`,
    passwordResetSuccess: `${publicServerURL}/public/success.html`,
    verifyEmailSuccess: `${publicServerURL}/public/verify_email.html`,
  },
});

// Create the app and init our custom APIs
const app = coreApi.initApp(serverId);

// Serve the Parse API on the /1 URL prefix
app.use(mountPath, api);

// Final handler - Bugsnag. This handles any errors that Express catches
app.use(coreApi.bugsnagMiddleware.errorHandler);

// Start the server
const httpServer = require('http').createServer(app);
httpServer.listen(port, function() {
  console.info(`API Server running on port ${port} for environment ${serverId}.`);
  console.info(`Connected to database: ${coreApi.utils.getSafeDbURI(databaseUri)}`);
});

// This will enable the Live Query real-time server
ParseServer.createLiveQueryServer(httpServer);

Many thanks

Are you also initializing the GraphQL server?

No, only using REST atm.

Sorry for the delay. Have you figured it out? Do you mind to try without loading the cloud code?