Setting up Mailgun with Meteor JS on Heroku - Error 554 - javascript

I've been trying to set up my mailgun to work with my Meteor app. When I use the sandbox, it works perfectly, but when I use the custom domain, I get an error:
Exception while invoking method 'forgotPassword' DeliveryError: Message delivery failed: 554 The domain is unverified and requires DNS configuration. Log in to your control panel to view required DNS records.
I've set up my configurations, so when I heroku config on the cmd, I get my vars and they're all correct.
MAILGUN_API_KEY: key-<api>
MAILGUN_DOMAIN: <appname>.herokuapp.com
MAILGUN_PUBLIC_KEY: pubkey-<key>
MAILGUN_SMTP_LOGIN: postmaster#<appname>.herokuapp.com
MAILGUN_SMTP_PASSWORD: <password>
MAILGUN_SMTP_PORT: 587
I've also set my app's environment variables in server/server.js like this:
Meteor.startup(function(){
process.env.MAIL_URL = 'smtp://postmaster%40<appname>.herokuapp.com:<password>#smtp.mailgun.org:587';
});
Am I missing something?

Related

Netlify "user is not authorized to perform: dynamodb:PutItem on resource"

I'm trying to get a hand with Netlify and AWS. I have downloaded a sample REST API preset from the official serverless site here.
The site worked locally after serverless deploy including the create route, used to add new todo elements into the db (API gateway on Amazon shows no issues)
I wanted to test how would it work on netlify, so I created a bitbucket repo from the file and uploaded it into the netlify servers.
From the start, there were minor issues. Such as an error claiming that TableName which in code is created from process.env.DYNAMODB_TABLE was not provided.
After replacing the value with the value of the field, I got an error saying that
{User: arxxxx:assumed-role/aws-lambda-execute/xxx is not authorized to perform: dynamodb:PutItem on resource: arn:aws:dynamodb:us-xxx-1:xxx:table/serverless-rest-api-with-dynamodb-dev","code":"AccessDeniedException","time":"xxx","requestId":"xxx","statusCode":400,"retryable":false,"retryDelay":30.76949318814495}
The issue suggests that my serverless parameters are wrong, however I do have the permissions set:
provider:
name: aws
runtime: nodejs6.10
environment:
DYNAMODB_TABLE: ${self:service}-${opt:stage, self:provider.stage}
iamRoleStatements:
- Effect: Allow
Action:
- dynamodb:Query
- dynamodb:Scan
- dynamodb:GetItem
- dynamodb:PutItem
- dynamodb:UpdateItem
- dynamodb:DeleteItem
Resource: "arn:aws:dynamodb:${opt:region, self:provider.region}:*:table/${self:provider.environment.DYNAMODB_TABLE}"
And all seem to work fine when the data is local.
Has anyone ever had such issue?

Deployed database has no connections

I have deployed an application to heroku: https://stark-citadel-91743.herokuapp.com/
The app initially loads properly until you click a button that requires the database. Then it crashes.
Everything works in local development environment. I believe I have properly set up all connection settings for production in heroku dashboard's config variables (database url, database name, username, password). But in production it doesn't work.
Two evidences that it's not set up right:
1) When I log into the ClearDB MySQL plugin (in my heroku dashboard) under 'current connections' it says, 'No connections are currently established to the database.'
2) When I use postman to hit a custom endpoint I made just for testing a request to the database, I get: "Error adding color: Error: connect ECONNREFUSED 127.0.0.1:3306" <-- that 127.0.0.1 seems enlightening. Why would a deployed db have a connection on that address?
Any clues? Thank you!
If your database is also set up at keroku host:
check the db setting(username, pw, port,etc.)
If you actually need to connect back to your own database(which is hosted by you or other third party);
You should find out the setting and replace with 127.0.0.1:3306, which is only work for local env
Update:
127.0.0.1 is localhost, which is your machine. Your test case is working because your server and your database are hosting on the same machine(which both have same ip). However, when your code are deployed to heroku, your heroku server cannot find a database hosted on same machine. This is why your are having this problem

Mean app login not working on heroku

I have followed many tutorials on how to get mongodb and MEAN to work on heroku, and none of them have worked for me, I keep getting the 503 application error.
First I create the app, I do heroku addons:docs mongolab in the commandline, and after that I check my config and change my code so the mongoose connection is changed to the config string like this:
mongoose.connect(process.env.MONGOLAB_URI || mongodb://example:example#ds053312.mongolab.com:53312/todolist');
the second part is just an example, the one I use is the one with my information.
So after this I push my app to heroku, but when I try to run it, it still gives me the application error, and in f12 it says it's
Failed to load resource: the server responded with a status of 503
(Service Unavailable)
https://myapp.herokuapp.com/favicon.ico
What am I doing wrong? I have tried everything and none of the tutorials are working for me
EDIT: I have managed to get rid of the error by doing the following:
$ git init
$ git add .
$ git commit -m "initial version"
$ heroku apps:create
however, now that my app loads, it appears that the login and sign up features of my app doesn't work, I fill out the sign in/log in form and submit but the page just stays where it is without changing. Is there something else I was supposed to do to get these features to work?
I came here because my Heroku - deploy Login wasn't working, but Localhost was. Turns out I forgot to change the Login POST route.

Can't deploy todos; Failed to remove container (todos-frontend)

First time with linux and meteor up, so sorry if there's a stupid mistake. I try to deploy the meteor example app todos with mupx, and followed the instructions from the readme, but I'm getting the following mistake. (I'm using Ubuntu 14.04 LTS Server ). Thanks for help.
Configuration file : mup.json
Settings file : settings.json
“ Checkout Kadira!
It's the best way to monitor performance of your app.
Visit: https://kadira.io/mup ”
Meteor app path : /home/jan/todos
Using buildOptions : {}
Currently, it is only possible to build iOS apps on an OS X system.
Started TaskList: Deploy app 'todos' (linux)
[h2544161.stratoserver.net] - Uploading bundle
[h2544161.stratoserver.net] - Uploading bundle: SUCCESS
[h2544161.stratoserver.net] - Sending environment variables
[h2544161.stratoserver.net] - Sending environment variables: SUCCESS
[h2544161.stratoserver.net] - Initializing start script
[h2544161.stratoserver.net] - Initializing start script: SUCCESS
[h2544161.stratoserver.net] - Invoking deployment process
Invoking deployment process: FAILED
-----------------------------------STDERR-----------------------------------
Failed to remove container (todos-frontend): Error response from daemon: No such container: todos-frontend
docker: Error response from daemon: failed to create endpoint todos on network bridge: Error starting userland proxy: listen tcp 0.0.0.0:80: bind: address already in use.
-----------------------------------STDOUT-----------------------------------
todos
base: Pulling from meteorhacks/meteord
518dc1482465: Already exists
a3ed95caeb02: Already exists
a3ed95caeb02: Already exists
a3ed95caeb02: Already exists
537c534356b6: Already exists
b65a0e1e554b: Already exists
a3ed95caeb02: Already exists
a3ed95caeb02: Already exists
Digest: sha256:b5a4f6efa98e4070792ed36d33b14385a28e6ceda691a492ee5b9f2431b1515a
Status: Image is up to date for meteorhacks/meteord:base
d6d192579495851d5817288ff89abb69512562d7c2a7075f965484e64583c61b
Failed to remove container (todos-frontend): Error response from daemon: No such container: todos-frontend
docker: Error response from daemon: failed to create endpoint todos on network bridge: Bind for 0.0.0.0:80 failed: port is already allocated.
Just had the same issue,
finally deployed after changing file port number to an unused port in my-deployment mup.json somehow docker service could release ports automatically when it wants. I've used 80, 8000, 8001 so far but I haven't successfully deployed to the same port twice, but reading
credit to this
It seems that different deployments may conflict each other pretty easily. I have no resolution for this.

Meteor mail not sending despite setting MAIL_URL environment variable

I'm getting this error message in the terminal "Mail not sent; to enable sending, set the MAIL_URL environment variable." despite setting MAIL_URL environment variable. After this message the whole mail content html gets dumped in the terminal. I'm using 2 meteor packages for sending email: yogiben:pretty-emails and email with mailgun api service.
Here's the source code for the mail config and sending email:
if Meteor.isServer
Meteor.startup ->
process.env.MAIL_URL = 'smtp://sandboxid.mailgun.org:mypassword#smtp.mailgun.org:587'
return
PrettyEmail.options =
from: 'primaryemail#gmail.com'
siteName: 'Meteor Test'
companyAddress: 'sdfsf, gdfg-df'
companyName: 'Code to Create'
companyUrl: 'http://example.com'
Accounts.sendVerificationEmail ->
Meteor.userId()
This file is kept inside Project_Directory/both/_config directory. I'm currently developing this app on local ubuntu server.
I think the call to sendVerificationEmail should be:
Accounts.sendVerificationEmail Meteor.userId()
as per the docs at http://docs.meteor.com/#/full/accounts_sendverificationemail
If that code is the exact code you're using, then you may be having issues because of the order in which each piece of code runs (callbacks run asynchronously). The startup callback will run after PrettyEmail.options and Accounts.sendVerificationEmail
If you indent those two sections as follows it should work as expected:
if Meteor.isServer
Meteor.startup ->
process.env.MAIL_URL = 'smtp://sandboxid.mailgun.org:mypassword#smtp.mailgun.org:587'
PrettyEmail.options =
from: 'primaryemail#gmail.com'
siteName: 'Meteor Test'
companyAddress: 'sdfsf, gdfg-df'
companyName: 'Code to Create'
companyUrl: 'http://example.com'
Accounts.sendVerificationEmail Meteor.userId()
Failing that it may also be worth setting MAIL_URL before running the app, for example:
MAIL_URL="smtp://sandboxid.mailgun.org:mypassword#smtp.mailgun.org:587" meteor
EDIT:
Your example code is not secure: If you are keeping this code in the 'both' directory, then anyone accessing your website will be able to see your mailgun credentials. You should put server code in the 'server' directory or at the very least set the MAIL_URL outside of your code as shown above.
I came across the same error. The trick was to not include the MAIL_URL in the application, but in the terminal where you run meteor itself.
Use the following command to run meteor:
MAIL_URL="smtp://postmaster#sandbox****.mailgun.org:XXXX#smtp.mailgun.org:587" meteor
I tried this on Ubuntu Terminal, hence should work on Mac as well.

Categories

Resources