How can I do a Facebook Connect with meteor.js? - facebook

I always get the following error when I do a FacebookConnect:
W20140817-21:48:56.623(2)? (STDERR) TypeError: Cannot call method 'remove' of undefined
W20140817-21:48:56.624(2)? (STDERR) at app/server/oauth.js:2:36
W20140817-21:48:56.624(2)? (STDERR) at app/server/oauth.js:11:3
W20140817-21:48:56.625(2)? (STDERR) at /Users/username/copro/chatapp/.meteor/local/build/programs/server/boot.js:161:10
W20140817-21:48:56.625(2)? (STDERR) at Array.forEach (native)
W20140817-21:48:56.625(2)? (STDERR) at Function._.each._.forEach (/Users/username/.meteor/tools/cef2bcd356/lib/node_modules/underscore/underscore.js:79:11)
W20140817-21:48:56.625(2)? (STDERR) at /Users/username/copro/chatapp/.meteor/local/build/programs/server/boot.js:82:5
How can I fix this error?

Related

Meteor error - Storing tasks in a collection

I am following the meteor site tutorial (https://www.meteor.com/tutorials/blaze/collections).
But when you add the line:
export const Tasks = new Mongo.Collection('tasks');
I get the following error:
/Users/user/.meteor/packages/meteor-tool/.1.4.1_2.fpzmec++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:313
throw(ex);
^
MongoError: failed to connect to server [localhost:27017] on first connect
at Object.Future.wait (/Users/user/.meteor/packages/meteor-tool/.1.4.1_2.fpzmec++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:449:15)
at new MongoConnection (packages/mongo/mongo_driver.js:216:27)
at new MongoInternals.RemoteCollectionDriver (packages/mongo/remote_collection_driver.js:4:16)
at Object.<anonymous> (packages/mongo/remote_collection_driver.js:38:10)
at Object.defaultRemoteCollectionDriver (packages/underscore/underscore.js:750:1)
at new Mongo.Collection (packages/mongo/collection.js:103:40)
at meteorInstall.imports.api.tasks.js (imports/api/tasks.js:4:14)
at fileEvaluate (packages/modules-runtime/.npm/package/node_modules/install/install.js:153:1)
at Module.require (packages/modules-runtime/.npm/package/node_modules/install/install.js:82:1)
at Module.Mp.import (/Users/user/.meteor/packages/modules/.0.7.6_1.j54juu++os+web.browser+web.cordova/npm/node_modules/reify/lib/runtime.js:70:16)
- - - - -
at [object Object].<anonymous> (/Users/user/.meteor/packages/npm-mongo/.1.5.50.1g0yl8n++os+web.browser+web.cordova/npm/node_modules/mongodb-core/lib/topologies/server.js:313:35)
at emitOne (events.js:77:13)
at [object Object].emit (events.js:169:7)
at [object Object].<anonymous> (/Users/user/.meteor/packages/npm-mongo/.1.5.50.1g0yl8n++os+web.browser+web.cordova/npm/node_modules/mongodb-core/lib/connection/pool.js:260:12)
at [object Object].g (events.js:260:16)
at emitTwo (events.js:87:13)
at [object Object].emit (events.js:172:7)
at Socket.<anonymous> (/Users/user/.meteor/packages/npm-mongo/.1.5.50.1g0yl8n++os+web.browser+web.cordova/npm/node_modules/mongodb-core/lib/connection/connection.js:162:49)
at Socket.g (events.js:260:16)
at emitOne (events.js:77:13)
Exited with code: 1
Your application is crashing. Waiting for file change.
The line in the tutorial:
export const Tasks = new Mongo.Collection('tasks');
Is different from your line:
Export Tasks const = new Mongo.Collection ('tasks');
The goal of the code is to initialize a new constant, Tasks, set it to a new Mongo.Collection, and then export it.

How do I connect to an external MongoDB Collection in a Meteor App

By default the Meteor app has access to collections in a database called meteor, but I would like to connect to a collection contained in a different database.
Looking around, I found some snippets which try to do the following:
var mongoUrl = 'mongodb://127.0.0.1:27018/meteor';
var oplogUrl = 'mongodb://127.0.0.1:27018/local';
var remoteDriver = new MongoInternals.RemoteCollectionDriver(mongoUrl, {
oplogUrl: oplogUrl,
});
var remoteCollection = new Mongo.Collection('extract', {
_driver: remoteDriver,
});
But doing so my app is crashing giving the following error:
> Exited with code: 8
? (STDERR)
? (STDERR) /Users/test/.meteor/packages/meteor-tool/.1.3.3.ems6rm++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:280
? (STDERR) throw(ex);
? (STDERR) ^
? (STDERR) Error: $MONGO_OPLOG_URL must be set to the 'local' database of a Mongo replica set
? (STDERR) at Error (<anonymous>)
? (STDERR) at OplogHandle._startTailing (packages/mongo/oplog_tailing.js:216:13)
? (STDERR) at new OplogHandle (packages/mongo/oplog_tailing.js:76:8)
? (STDERR) at new MongoConnection (packages/mongo/mongo_driver.js:216:25)
? (STDERR) at new MongoInternals.RemoteCollectionDriver (packages/mongo/remote_collection_driver.js:4:16)
? (STDERR) at meteorInstall.collections.job_extract.js (collections/job_extract.js:10:20)
? (STDERR) at fileEvaluate (packages/modules-runtime/.npm/package/node_modules/install/install.js:153:1)
? (STDERR) at require (packages/modules-runtime/.npm/package/node_modules/install/install.js:82:1)
? (STDERR) at /Users/test/app_meteor/.meteor/local/build/programs/server/app/app.js:1453:1
? (STDERR) at /Users/test/app_meteor/.meteor/local/build/programs/server/boot.js:291:10
? (STDERR) at Array.forEach (native)
? (STDERR) at Function._.each._.forEach (/Users/arj/.meteor/packages/meteor-tool/.1.3.3.ems6rm++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/underscore/underscore.js:79:11)
? (STDERR) at /Users/test/app_meteor/.meteor/local/build/programs/server/boot.js:133:5
You can do it through running command inside an meteor app
export MONGO_URL=URL.
Then your app will be connected to the URL database.

REST route not working with Meteor's iron router

I'm trying to create a simple REST api in my Meteor app. Using the exact example from the doc
Router.route('/webhooks/stripe', { where: 'server' })
.get(function () {
// GET /webhooks/stripe
})
.post(function () {
// POST /webhooks/stripe
})
.put(function () {
// PUT /webhooks/stripe
})
throw an error:
=> Exited with code: 8
W20160116-16:39:15.200(-8)? (STDERR)
W20160116-16:39:15.201(-8)? (STDERR) /Users/me/.meteor/packages/meteor-tool/.1.1.10.1b51q9m++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:245
W20160116-16:39:15.201(-8)? (STDERR) throw(ex);
W20160116-16:39:15.201(-8)? (STDERR) ^
W20160116-16:39:15.204(-8)? (STDERR) TypeError: Object [object Object] has no method 'get'
W20160116-16:39:15.205(-8)? (STDERR) at lib/router.js:9:4
W20160116-16:39:15.205(-8)? (STDERR) at /Users/me/repo/.meteor/local/build/programs/server/app/lib/router.js:25:4
W20160116-16:39:15.205(-8)? (STDERR) at /Users/me/repo/.meteor/local/build/programs/server/boot.js:242:10
W20160116-16:39:15.205(-8)? (STDERR) at Array.forEach (native)
W20160116-16:39:15.205(-8)? (STDERR) at Function._.each._.forEach (/Users/me/.meteor/packages/meteor-tool/.1.1.10.1b51q9m++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/underscore/underscore.js:79:11)
W20160116-16:39:15.205(-8)? (STDERR) at /Users/me/repo/.meteor/local/build/programs/server/boot.js:137:5
Any idea?
It seems to me that you perhaps missed to install iron-router?
.. at /Users/me/repo/.meteor/local/build/programs/server/app/lib/router.js:25:4
This seems to indicate that Router is still the meteor own router, not iron-router, which lives somewhere in
/Users/me/repo/.meteor/local/build/programs/server/packages
Make sure you ran:
meteor add iron:router
You can see which packages are already installed using meteor list.

Error referring to the same Mongo.Collection from two .js files in Meteor

I have this line in two .js files in Meteor:
merchants = new Mongo.Collection('merchants');
It blows up with the error message below. Why?
Tried adding var
Removing the line in one of the files helps.
What am I doing wrong?
`W20150614-11:20:50.527(-7)? (STDERR) at app\signUp\signUp.js:1:48
W20150614-11:20:50.527(-7)? (STDERR) at app\signUp\signUp.js:54:3
W20150614-11:20:50.529(-7)? (STDERR) at E:\work\meteor3\app\merchant\.m
eteor\local\build\programs\server\boot.js:222:10
W20150614-11:20:50.529(-7)? (STDERR) at Array.forEach (native)
W20150614-11:20:50.529(-7)? (STDERR) at Function._.each._.forEach (C:\Users\
I\AppData\Local\.meteor\packages\meteor-tool\1.1.3\mt-os.windows.x86_32\dev_bund
le\server-lib\node_modules\underscore\underscore.js:79:11)
W20150614-11:21:03.189(-7)? (STDERR)
W20150614-11:21:03.190(-7)? (STDERR) C:\Users\I\AppData\Local\.meteor\packages\m
eteor-tool\1.1.3\mt-os.windows.x86_32\dev_bundle\server-lib\node_modules\fibers\
future.js:245
W20150614-11:21:03.191(-7)? (STDERR)
throw(ex);
W20150614-11:21:03.191(-7)? (STDERR)
^
W20150614-11:21:03.192(-7)? (STDERR) Error: A method named '/merchants/insert' is already defined
W20150614-11:21:03.193(-7)? (STDERR) at packages/ddp/livedata_server.js:1461
:1
W20150614-11:21:03.193(-7)? (STDERR) at Function._.each._.forEach (packages/
underscore/underscore.js:113:1)
W20150614-11:21:03.194(-7)? (STDERR) at [object Object]._.extend.methods (pa
ckages/ddp/livedata_server.js:1459:1)
W20150614-11:21:03.194(-7)? (STDERR) at [object Object].Mongo.Collection._de
fineMutationMethods (packages/mongo/collection.js:904:1)
W20150614-11:21:03.195(-7)? (STDERR) at new Mongo.Collection (packages/mongo
/collection.js:209:1)
W20150614-11:21:03.196(-7)? (STDERR) at app\signUp\signUp.js:1:48
W20150614-11:21:03.196(-7)? (STDERR) at app\signUp\signUp.js:54:3
W20150614-11:21:03.197(-7)? (STDERR) at E:\work\meteor3\app\merchant\.m
eteor\local\build\programs\server\boot.js:222:10
W20150614-11:21:03.198(-7)? (STDERR) at Array.forEach (native)
W20150614-11:21:03.199(-7)? (STDERR) at Function._.each._.forEach (C:\Users\
I\AppData\Local\.meteor\packages\meteor-tool\1.1.3\mt-os.windows.x86_32\dev_bund
You only need one new Mongo.Collection declaration per collection in meteor app.

Error deploying a meteor app

When deploying a meteor app, I run into this error:
Errors prevented deploying:
Exception while bundling application:
Error: EACCES, permission denied '/Users/andyjiang/Developer/hackathon/meteor/instachat/.meteor/local/build_tar/bundle/app/instachat.js'
at Object.fs.unlinkSync (fs.js:582:18)
at Object._.extend.rm_recursive (/Users/andyjiang/.meteor/tools/11f45b3996/tools/files.js:280:10)
at _.extend.rm_recursive (/Users/andyjiang/.meteor/tools/11f45b3996/tools/files.js:276:15)
at Array.forEach (native)
at Function._.each._.forEach (/Users/andyjiang/.meteor/tools/11f45b3996/lib/node_modules/underscore/underscore.js:79:11)
at Object._.extend.rm_recursive (/Users/andyjiang/.meteor/tools/11f45b3996/tools/files.js:274:9)
at _.extend.rm_recursive (/Users/andyjiang/.meteor/tools/11f45b3996/tools/files.js:276:15)
at Array.forEach (native)
at Function._.each._.forEach (/Users/andyjiang/.meteor/tools/11f45b3996/lib/node_modules/underscore/underscore.js:79:11)
at Object._.extend.rm_recursive (/Users/andyjiang/.meteor/tools/11f45b3996/tools/files.js:274:9)
at _.extend.write_to_directory (/Users/andyjiang/.meteor/tools/11f45b3996/tools/bundler.js:808:11)
at Object.exports.bundle (/Users/andyjiang/.meteor/tools/11f45b3996/tools/bundler.js:887:12)
at deployToServer (/Users/andyjiang/.meteor/tools/11f45b3996/tools/deploy.js:95:24)
at deployCmd (/Users/andyjiang/.meteor/tools/11f45b3996/tools/deploy.js:78:7)
at exports.inFiber (/Users/andyjiang/.meteor/tools/11f45b3996/tools/fiber-helpers.js:24:12)
/Users/andyjiang/.meteor/tools/11f45b3996/tools/fiber-helpers.js:25
}).run();
^
Error: EACCES, permission denied '/Users/andyjiang/Developer/hackathon/meteor/instachat/.meteor/local/build_tar/bundle/app/instachat.js'
at Object.fs.unlinkSync (fs.js:582:18)
at Object._.extend.rm_recursive (/Users/andyjiang/.meteor/tools/11f45b3996/tools/files.js:280:10)
at _.extend.rm_recursive (/Users/andyjiang/.meteor/tools/11f45b3996/tools/files.js:276:15)
at Array.forEach (native)
at Function._.each._.forEach (/Users/andyjiang/.meteor/tools/11f45b3996/lib/node_modules/underscore/underscore.js:79:11)
at Object._.extend.rm_recursive (/Users/andyjiang/.meteor/tools/11f45b3996/tools/files.js:274:9)
at _.extend.rm_recursive (/Users/andyjiang/.meteor/tools/11f45b3996/tools/files.js:276:15)
at Array.forEach (native)
at Function._.each._.forEach (/Users/andyjiang/.meteor/tools/11f45b3996/lib/node_modules/underscore/underscore.js:79:11)
at Object._.extend.rm_recursive (/Users/andyjiang/.meteor/tools/11f45b3996/tools/files.js:274:9)
at _.extend.rm_recursive (/Users/andyjiang/.meteor/tools/11f45b3996/tools/files.js:276:15)
at Array.forEach (native)
at Function._.each._.forEach (/Users/andyjiang/.meteor/tools/11f45b3996/lib/node_modules/underscore/underscore.js:79:11)
at Object._.extend.rm_recursive (/Users/andyjiang/.meteor/tools/11f45b3996/tools/files.js:274:9)
at deployToServer (/Users/andyjiang/.meteor/tools/11f45b3996/tools/deploy.js:101:11)
at deployCmd (/Users/andyjiang/.meteor/tools/11f45b3996/tools/deploy.js:78:7)
at exports.inFiber (/Users/andyjiang/.meteor/tools/11f45b3996/tools/fiber-helpers.js:24:12)
The app runs fine locally. I've deployed other Meteor apps without any issues, as well. Any idea what the error could be?
Thanks,
Andy