我在這裏以下教程:http://experimentsinmeteor.com/photo-blog-part-1/錯誤:FS.Store.S3你必須指定「桶」選項(meteor.js和S3)
我可以讓我的應用程序時,我用它來運行良好:
meteor --settings settings.json
但當我只是用「meteor
」,開始了我的本地服務器,或當我的應用程序部署到我的生產(在Heroku),應用程序崩潰,並且我得到這個輸出:
=> Started proxy.
=> Started MongoDB.
W20160227-10:30:11.721(-8)? (STDERR)
W20160227-10:30:11.722(-8)? (STDERR) /Users/*************/.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
W20160227-10:30:11.722(-8)? (STDERR) throw(ex);
W20160227-10:30:11.722(-8)? (STDERR) ^
W20160227-10:30:11.722(-8)? (STDERR) Error: FS.Store.S3 you must specify the "bucket" option
W20160227-10:30:11.723(-8)? (STDERR) at new FS.Store.S3 (packages/cfs_s3/packages/cfs_s3.js:95:1)
W20160227-10:30:11.723(-8)? (STDERR) at lib/collections/images.js:2:20
W20160227-10:30:11.723(-8)? (STDERR) at /Users/**************/www/myapp/.meteor/local/build/programs/server/app/lib/collections/images.js:58:4
W20160227-10:30:11.723(-8)? (STDERR) at /Users/**************/www/myapp/.meteor/local/build/programs/server/boot.js:242:10
W20160227-10:30:11.723(-8)? (STDERR) at Array.forEach (native)
W20160227-10:30:11.723(-8)? (STDERR) at Function._.each._.forEach (/Users/***************/.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)
W20160227-10:30:11.723(-8)? (STDERR) at /Users/*************/www/myapp/.meteor/local/build/programs/server/boot.js:137:5
=> Exited with code: 8
我有這個該應用第部構造類似於它在教程做的方式:
我有一個的.gitignore僅包括settings.json
我在根目錄下的文件settings.json:
{
"AWSAccessKeyId" : "access key",
"AWSSecretAccessKey" : "secret",
"AWSBucket" : "bucket name"
}
然後,我有一個lib /收藏/ images.js文件:
if (Meteor.isServer) {
var imageStore = new FS.Store.S3("images", {
/* OPTIONAL IN MOST CASES */
region: "us-west-1", // substitute the region you selected
/* REQUIRED */
accessKeyId: Meteor.settings.AWSAccessKeyId,
secretAccessKey: Meteor.settings.AWSSecretAccessKey,
bucket: Meteor.settings.AWSBucket
});
Images = new FS.Collection("Images", {
stores: [imageStore],
filter: {
allow: {
contentTypes: ['image/*']
}
}
});
}
// On the client just create a generic FS Store as don't have
// access (or want access) to S3 settings on client
if (Meteor.isClient) {
var imageStore = new FS.Store.S3("images");
Images = new FS.Collection("Images", {
stores: [imageStore],
filter: {
allow: {
contentTypes: ['image/*']
},
onInvalid: function(message) {
Bert.alert(message);
}
}
});
}
// Allow rules
Images.allow({
insert: function() { return true; },
update: function() { return true; }
});
我知道這工作,因爲我能夠存儲圖像,當我運行:
meteor --settings settings.json
它只是單獨使用'流星',並在生產中出現這個錯誤彈出(檢查heroku日誌並顯示相同的東西)。