# Ember concurrency bug

**URL:** <https://discuss.emberjs.com/t/ember-concurrency-bug/14751>\
**Category:** Uncategorized\
**Created:** [May 14, 2018, 12:22pm UTC](https://discuss.emberjs.com/t/ember-concurrency-bug/14751 "2018-05-14T12:22:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![CezaryH](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/cezaryh/32/13527_2.png) [@CezaryH](https://discuss.emberjs.com/u/CezaryH)\
**Post date:** [May 14, 2018, 12:22pm UTC](https://discuss.emberjs.com/t/ember-concurrency-bug/14751/1 "2018-05-14T12:22:44Z")

</div>

Hey, there’s an issue with timeout function in utils.js after production build with target set to last 1 chrome version only.

For demo open console and go to [https://cezaryh.github.io/ember-concurrency-utils-bug/](https://cezaryh.github.io/ember-concurrency-utils-bug/)

there’s bug in ember-concurrency/utils module in timeout function. After minification it looks like this:

e.timeout = function(e) { let t = new Ember.RSVP.Promise((t)=\>{ n = Ember.run.later(t, e) }), n; return t. **ec\_cancel** = ()=\>{ Ember.run.cancel(n) } , t } which causes error “n is not defined”.

but the same code copied to other file ([ember-concurrency-utils-bug/utils.js at master · CezaryH/ember-concurrency-utils-bug · GitHub](https://github.com/CezaryH/ember-concurrency-utils-bug/blob/master/app/utils.js)) does not throw an error, and is minified differently

a.timeout = function(a) { let b, c = new Ember.RSVP.Promise((c)=\>{ b = Ember.run.later(c, a) }); return c. **ec\_cancel** = ()=\>{ Ember.run.cancel(b) } ,c } in this case “b” is defined

that happens when build target is “last 1 Chrome versions”

config/targets.js

module.exports = { browsers: [‘last 1 Chrome versions’] };

I can’t figure out how to solve that, any ideas ?

that’s also posted in ember-concurrency github

> <https://github.com/machty/ember-concurrency/issues/232>
>
> Hey,
> there's an issue with timeout function in utils.js after production build …with target set to last 1 chrome version only.
> 
> !\[image\](https://user-images.githubusercontent.com/1262544/39996739-dcfe3b68-5780-11e8-848e-2e1972bb746f.png)
> For demo open console and go to 
> https://cezaryh.github.io/ember-concurrency-utils-bug/
> 
> there's bug in ember-concurrency/utils module in timeout function. After minification it looks like this:
> 
> \`\`\`
> e.timeout = function(e) {
> let t = new Ember.RSVP.Promise((t)=\>{
> n = Ember.run.later(t, e)
> }), n;
> return t.\_\_ec\_cancel\_\_ = ()=\>{
> Ember.run.cancel(n)
> }
> , t
> }
> \`\`\` 
> which causes error "n is not defined".
> 
> but the same code copied to other file (https://github.com/CezaryH/ember-concurrency-utils-bug/blob/master/app/utils.js) does not throw an error, and is minified differently 
> 
> \`\`\`
> a.timeout = function(a) {
> let b, c = new Ember.RSVP.Promise((c)=\>{
> b = Ember.run.later(c, a)
> });
> return c.\_\_ec\_cancel\_\_ = ()=\>{
> Ember.run.cancel(b)
> }
> ,c
> }
> \`\`\`
> in this case "b" is defined
> 
> that happens when build target is "last 1 Chrome versions"
> 
> config/targets.js
> \`\`\`
> module.exports = {
> browsers: \[
> 'last 1 Chrome versions'
> \]
> };
> \`\`\`
