-
-
Notifications
You must be signed in to change notification settings - Fork 595
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
Parse is not a singleton anymore > v2.8.0 #966
Labels
state:duplicate
Duplicate of already reported issue
Comments
I don't believe such changes were made in 2.8.0. Are you running this in cloud code? If so you don't need to import Parse |
Cloud code is also. So I remove all index.js 'use strict'
import dotenv from 'dotenv'
dotenv.config()
const ParseServer = require('parse-server').ParseServer
import express from 'express'
import ParseDashboard from 'parse-dashboard'
import path from 'path'
import {initSchema} from './src/schema' /************ Here **************/
const app = express()
// mongodb://username:password@ggg.com:27017/dbname
let databaseURI = process.env.LOCAL_DB_URI
// Specify the connection string for your mongodb database
// and the location to your Parse cloud code
const api = new ParseServer({
databaseURI,
cloud: __dirname + '/src/cloud/', // location after tsc
appId: process.env.APP_ID,
masterKey: process.env.MASTER_KEY,
fileKey: process.env.FILE_KEY,
serverURL: 'http://localhost:1337/parse', // Don't forget to add this line to change port or url
// enableAnonymousUsers: true,
liveQuery: {
// classNames: ['Alram'],
},
})
// Serve static assets from the /public folder
app.use('/', express.static(path.join(__dirname, '/public')))
// Serve the Parse API on the /parse URL prefix
app.use(process.env.PARSE_API_PREFIX, api)
// Hello world
// app.get('/', function(req, res) {
// res.status(200).send('Init.');
// });
const httpServer = require('http').createServer(app) // Need for livequery
const port = process.env.PORT
httpServer.listen(port, function() {
console.log('parse-server running on port %s', port)
})
ParseServer.createLiveQueryServer(httpServer)
initSchema() //************ Here **************/ .src/schema.js import Parse from 'parse/node' // Import makes a problem in parse > v2.8.0
const initSchema = async () => {
try {
new Parse.Schema('UserInfo').save({useMasterKey: true}),
}
} catch (error) {
throw error
}
}
export {initSchema} Anyway, I resolved this issue to do not |
Duplicate parse-community/parse-server#5278 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Issue Description
index.js
schema.js
It had no problem until v2.7.1 . And
Parse
worked as singleton.But
import Parse from 'parse/node'
looks to create new Parse instance in v2.8.0.So we need to use
Parse
as global variable withoutimport
after v2.8.0.Is there any changes from v2.8.0 release related?
Steps to reproduce
Expected Results
Actual Outcome
Environment Setup
Server
JS SDK
Logs/Trace
The text was updated successfully, but these errors were encountered: