parse-community / parse-server-push-adapter

A push notification adapter for Parse Server
https://parseplatform.org
MIT License
87 stars 99 forks source link

Parse-Server Push Adapter FCM issue #51

Closed cubetjinil closed 7 years ago

cubetjinil commented 7 years ago

During migration ,i have added these lines of codes in my index.js files for configuring the push for android using FCM: https://github.com/parse-server-modules/parse-server-push-adapter/pull/41

push:{ fcm:{ senderId:"**", apiKey:"***" } }

But it throws | /home/ubuntu/parse-server/node_modules/parse-server-push-adapter/lib/ParsePushAdapter.js:80 0|npm | throw _iteratorError;

Is FCM supported in Parse Server? Is this Issue solved?

flovilmart commented 7 years ago

Can you provide the full stack trace please?

cubetjinil commented 7 years ago

Thanks for the reply here is our complete index.js file looks

// Example express application adding the parse-server module to expose Parse // compatible API routes. var express = require('express'); var ParseServer = require('parse-server').ParseServer; var S3Adapter = require('parse-server').S3Adapter; var path = require('path'); var databaseUri = process.env.DATABASE_URI || process.env.MONGODB_URI;

if (!databaseUri) { console.log('DATABASE_URI not specified, falling back to localhost.'); }

var api = new ParseServer({ databaseURI: databaseUri || 'mongodb://parse:password@*/', cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js', appId: process.env.APP_ID || '**', masterKey: process.env.MASTER_KEY || '*****', //Add your master key here. Keep it secret! serverURL: process.env.SERVER_URL || '**', // Don't forget to change to https if needed fileKey:'***', filesAdapter: new S3Adapter( "****", "**", "****", {directAccess: true} ), push: { fcm: { senderId: '**', apiKey: '****' } },

liveQuery: { classNames: ["Posts", "Comments"] // List of classes to support for query subscriptions } }); // Client-keys like the javascript key or the .NET key are not necessary with parse-server // If you wish you require them, you can set them as options in the initialization above: // javascriptKey, restAPIKey, dotNetKey, clientKey

var app = express();

// Serve static assets from the /public folder app.use('/public', express.static(path.join(__dirname, '/public')));

// Serve the Parse API on the /parse URL prefix var mountPath = process.env.PARSE_MOUNT || '/parse'; app.use(mountPath, api);

// Parse Server plays nicely with the rest of your web routes app.get('/', function(req, res) { res.status(200).send('I dream of being a website. Please star the parse-server repo on GitHub!'); });

// There will be a test page available on the /test path of your server url // Remove this before launching your app app.get('/test', function(req, res) { res.sendFile(path.join(__dirname, '/public/test.html')); });

var port = process.env.PORT || 1337; var httpServer = require('http').createServer(app); httpServer.listen(port, function() { console.log('parse-server-example running on port ' + port + '.'); });

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

and the error that we obtained is

/home/ubuntu/parse-server/node_modules/parse-server-push-adapter/lib/ParsePushAdapter.js:80 0|npm | throw _iteratorError; 0|npm | ^ 0|npm | [object Object] 0|npm | npm 0|npm |
0|npm | ERR! 0|npm | Linux 3.13.0-105-generic 0|npm | npm 0|npm | ERR! argv "/usr/bin/nodejs" "/usr/lib/node_modules/pm2/lib/ProcessContainerFork.js" "start" 0|npm | npm ERR! node v5.12.0 0|npm | npm ERR! npm v3.8.6 0|npm | npm ERR! code ELIFECYCLE 0|npm | npm ERR! 0|npm | parse-server-example@1.4.0 start: node index.js 0|npm | npm ERR! Exit status 1 0|npm | npm ERR! 0|npm | npm ERR! 0|npm | Failed at the parse-server-example@1.4.0 start script 'node index.js'. 0|npm | npm ERR! Make sure you have the latest version of node.js and npm installed. 0|npm | npm ERR! If you do, this is most likely a problem with the parse-server-example package, 0|npm | npm ERR! not with npm itself. 0|npm | npm ERR! Tell the author that this fails on your system: 0|npm | npm ERR! 0|npm | node index.js 0|npm | npm ERR! You can get information on how to open an issue for this project with: 0|npm | npm ERR! npm bugs parse-server-example 0|npm | npm 0|npm | ERR! Or if that isn't available, you can get their info via: 0|npm | npm ERR! npm owner ls parse-server-example 0|npm | npm ERR! There is likely additional logging output above. 0|npm | npm ERR! Please include the following file with any support request: 0|npm | npm ERR

flovilmart commented 7 years ago

@cubetjinil please update to the latest parse-server and re-open the issue if it persists.