-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SOLVED: How to deploy Ember App? Errors on everything. #141
Comments
Look in your .gitignore The following lines are present, which are preventing your secrets from being committed to github and heroku.
|
@faetea's advice is good. The way we recommended handling this is actually leaving the |
It seems that the front end is hitting the heroku api now, but no data is being exchanged. I am not able to create organizations, sign in, etc. Did I miss something in on the ember side? Was there something else I was supposed to put in the adapter besides the import? I added this to app/application/adapter.js My config/environment.js
On the landing page there is a form that has open create. This is the error on the front end (excerpt):
An error on the back end heroku logs, unsure if related to the post action:
|
Move those lines out of the production conditional. |
I still have the same errors.
|
We tried removing the trailing slash in ENV.host = 'https://earth-wars-api.herokuapp.com/' but there was still the same error. |
I deployed the front end to Heroku as well, with the same issue. Here's the latest error message:
|
Here are the steps I followed for the heroku app deployment. I also commented out the env variables:
|
I am able to run a localhost:4200 for the front end, and access the heroku api successfully, so it seems that this is an Ember deployment problem. James has the same 405 error, and can also use a localhost front end to make requests to heroku api. |
I re-deployed to Heroku with the dist folder included. Unfortunately the same error appears. I am going to stop working on this tonight and just finish up my README. |
I followed Matt's steps for deployment, however I am still encountering the same error, where the ember app seems to be placing CRUD requests to the front end url instead of the proper API url. What do I need to do in order for it to be placing requests to my heroku api? I know that heroku works because my presentation was given using localhost for the front end and heroku for the back end. Follow this link to see a live example of the error. The sign up form contains a GET request to create a list of all registered organizations, which fails like this:
The home page of the live deployment to gh-pages My config/environment file used during ember build:
|
@jenweber, I just updated my sample app to reference the Organization resource from your API, and my app seems to be loading the Organization names correctly. I wonder if the problem might be with something in the ember-auth template. I'll try to make another repo based on |
Hey @jenweber, I made a second app based on the It seems that the problem stems from the Here's the content of my export default AjaxService.extend({
auth: Ember.inject.service(),
host: 'https://earth-wars-api.herokuapp.com',
headers: Ember.computed('auth.credentials.token', {
get() {
let headers = {};
const token = this.get('auth.credentials.token');
if (token) {
headers['Authorization'] = `Token token=${token}`;
}
return headers;
}
})
}); This should fix your issues with auth. This should fix your auth issues. |
EDIT- removed my comment, ember version was not the issue |
SOLUTION: Below has everything you need to do, I think: Add a host to your adapter:
Add a host to your ajax service:
Follow Matt's Gist instructions to update your config/environment with a host and deploy to gh pages. Don't forget to commit. And finally, in order for your UPDATE actions to work, add ":put" to the Cors methods in Rails back end, in the config/application.rb file, commit, and push to heroku. Solution by @seatuna
|
*In addition to the above: to have the URL stored in only one location, you can store in the config/environment file & import the ENV file on the adapter & ajax files. Config/ environment: module.exports = function(environment) {
var ENV = {
modulePrefix: '<module-name>',
environment: environment,
baseURL: '/',
locationType: 'auto',
apiHost: 'http://localhost:3000', Ajax / service & application/adapter import Ember from 'ember';
import AjaxService from 'ember-ajax/services/ajax';
import ENV from '<module-name>/config/environment';
export default AjaxService.extend({
host: ENV.apiHost,
auth: Ember.inject.service(), |
I tweaked mine. I am declaring my heroku server host in the production variables still. config/environment.js
application adapter
ajax service
|
SCROLL DOWN TO THE LAST COMMENT IN THIS CHAIN TO SEE THE SOLUTION
I got the build to work. I was trying to specify the env url in the wrong place, at the top of the file instead of in the production if. But, I'm still running into issues. I'm not sure where to specify the heroku database url, and also heroku is complaining that I'm missing the secret key base.
I'm following the steps here for the back end, and here & here for the front end Ember to gh-pages.
In environment.js:
Heroku Error:
despite the fact that I set the secrets using rake secret and
heroku config:set SECRET_KEY_BASE=numbersandletters
I used heroku config to determine if I successfully set the secret key:
The text was updated successfully, but these errors were encountered: