2016-03-24 13 views
1

mlabを使用してparse.comからherokuにアプリケーションを移行しましたが、クラウドコードを除いてすべて正常に動作します。herokuの移行でパーズサーバーが動作しないマンドリル

私はここでHerokuの

で作業されていない解析クラウドコードからメールを送信するためのマンドリルを使用しています、私がこれまでにやっていることです:

  1. インストールマンドリル〜0.1.0構文解析サーバに [エラー]:無効な機能Herokuのアプリ
  2. へ〜実施例とプッシュコードは、などのエラーを応答するiOSアプリから「/cloud/main.js」
  3. 呼び出される関数に雲のコードを入れてください。 (コード:141、バージョン:1.13.0)。ここで

私のコードスクリプトです:

Parse.Cloud.define("sendMail", function(request, response) { 
        var Mandrill = require('mandrill'); 
        Mandrill.initialize('xxxxxx-xxxxx'); 

        Mandrill.sendEmail({ 
             message: { 
             text: "ffff", 
             subject: "hello", 
             from_email: "[email protected]", 
             from_name: "pqr", 
             to: [ 
              { 
              email: "[email protected]", 
              name: "trump" 
              } 
              ] 
             }, 
             async: true 
             },{ 
             success: function(httpResponse) { 
             console.log(httpResponse); 
             response.success("Email sent!"); 
             }, 
             error: function(httpResponse) { 
             console.error(httpResponse); 
             response.error("Uh oh, something went wrong"); 
             } 
             }); 
        }); 

しかし、 'sendmailの' 関数を呼び出した後、私はこのエラーを取得しています:

[エラー]:無効な機能。 (コード:141、バージョン:1.13.0)。 ================== MailGun ============== ============

答えて

0

私はsendgridと同様の問題がありましたが、私はついにこの問題を回避する方法を見つけました。

私はいくつかのブラケットやいくつかのコードの区切り

  1. ミス、この手順はあなたを助けるかもしれないと思いますか? (main.jsのコード全体を書き直してみてください)

  2. アプリは実際に動作していますか? (端末に "heroku open"と入力すると、デフォルトのメッセージが表示されます) - ステップ1を確認しない場合。

  3. 以前のバージョンが動作しない場合は、安全なビルドにロールバックして、アドオンをherokuダッシュボードをインストールするのではなく、gitをダウンロードしてgitに変更を加えてから押してください。 I以下

+0

ご返信いただきありがとうございます。あなたの最初の2つのステップの両方が問題ありません。私のアプリは動いている。しかし、マンドリルコードはそうではありません。マンドリルアドオンはありません。そしてgitをダウンロードし、git(サーバを解析する)を押すことはどういう意味ですか?私のマンドリルコードを実行する方法があれば。 – user3145442

+0

マンドリルアドオンがないのでうまく動作しないので、私はこのステップを提案した理由はダッシュボードからコンポーネントを追加するときに間違っていないと、herokuがgitを変更するためですアドオン、あなたは自分でそれらを行う必要はありませんこの方法で、おそらくプロセスの一部をスキップします。だから、これを実行した後、あなたはherokuのツールベルトを使ってgitをダウンロードしてから、gitの他の変更を行い、それをherokuアプリにプッシュします。それはsendgridを動作させる方法です。 – Rialcom

+0

あなたはクラウドコードを有効にしましたか?あなたはgitのdockerfileに行き、これをコメント解除する必要があります:VOLUME/parse/cloud – Rialcom

0

パスワード回復電子メールを送信するようにアプリケーションを解析Herokuの上マンドリルを使用して作業しているクラウドコードmain.jsコードから貼り付けています。クラウドコードmain.jsで

var mandrill_key = process.env.MANDRILL_KEY; 

var Mandrill = require('mandrill-api/mandrill'); 

var mandrill_client = new Mandrill.Mandrill(mandrill_key); 

{ 
    success: function(gameScore) { 
     //alert('New object created with objectId: ' + gameScore.id); 

     mandrill_client.messages.send(
     { 
      message: { 
       html: "<p>Hello " + firstUser.get('fullname') + ",</p><p>We received your request to reset your password.</p><p>Your user name is <strong>" + firstUser.get('username') + "</strong>. Please <a href=\"http://test-sample-app.herokuapp.com/?#/account/reset/password/" + jsonct.ct + "\">click here</a> to create a new password. This link will expire in one hour after this mail was sent</p><p>If you need additional help, just let us know.</p><p>SampleCompany Support<br>[email protected]</p><p>Copyright Sample Company, Inc. 2014-2017</p>", 
       subject: "Sample Company Name account recovery", 
       from_email: "[email protected]", 
       from_name: "Sample Company Name", 
       to: [ 
        { 
         email: firstUser.get('email'), 
         name: firstUser.get('fullname') 
        } 
       ] 
      }, 
      async: true 
     }, 
     //Success 
     function(httpResponse) { 
      console.log(httpResponse); 
      //alert("Email sent!"); 
     }, 
     //Failure 
     function(httpResponse) { 
      console.error(httpResponse); 
      //alert("Uh oh, something went wrong"); 
     }); 
    }, 
    error: function(gameScore, error) { 
     console.error(error.message); 
     //alert('Failed to create new object, with error code: ' + error.message); 
    }, 
    useMasterKey: true 
}) 
関連する問題