vendredi 2 janvier 2015

Ember.js application gives TypeError in production only

I'm building an ember-cli application that will use an API build with Django/DRF. I'm using the ember-django-adapter also.


When I run my API at localhost:8000 and run the ember app at localhost:4200, it works.


I have the following in my config/environment.js:



if (environment === 'production') {
ENV.APP.API_HOST = 'http://ift.tt/13NK49N';
ENV.APP.API_NAMESPACE = '';
}


When I do a production build of the ember application, and deploy it to Travis, the page does not load, and I get the following error in the console:



Uncaught TypeError: Attempting to register an unknown factory: `transform:date`


I'm baffled by this. There is a date in the model that the main route uses, but the key confusion is that this doesn't happen in development. Is there some other step that I need to get an ember app in s3 to connect to an external API?


If using CORS with Django in my API, and have the following in my settings.py:



CORS_ORIGIN_ALLOW_ALL = False

CORS_ORIGIN_WHITELIST = (
'localhost:4200',
'mybucket.s3-website-us-east-1.amazonaws.com'
)

CORS_ALLOW_HEADERS = (
'x-requested-with',
'content-type',
'accept',
'accept-encoding',
'origin',
'authorization',
'x-csrftoken'
)
CORS_EXPOSE_HEADERS = (
'Access-Control-Allow-Origin: *',
)


I appreciate any help.





Aucun commentaire:

Enregistrer un commentaire