# Deploy single function ends in runtime errors but deploying whole service is fine, feels like a web pack or babel issue

**URL:** <https://forum.serverless.com/t/deploy-single-function-ends-in-runtime-errors-but-deploying-whole-service-is-fine-feels-like-a-web-pack-or-babel-issue/2339>\
**Category:** Serverless Framework\
**Created:** [July 21, 2017, 3:02am UTC](https://forum.serverless.com/t/deploy-single-function-ends-in-runtime-errors-but-deploying-whole-service-is-fine-feels-like-a-web-pack-or-babel-issue/2339 "2017-07-21T03:02:10Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![delprofundo](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/delprofundo/32/175_2.png) [@delprofundo](https://forum.serverless.com/u/delprofundo)\
**Post date:** [July 21, 2017, 3:02am UTC](https://forum.serverless.com/t/deploy-single-function-ends-in-runtime-errors-but-deploying-whole-service-is-fine-feels-like-a-web-pack-or-babel-issue/2339/1 "2017-07-21T03:02:10Z")

</div>

Hey Team,

I’ve got another stack moving towards production and as such we are working a lot on our live dev environments. I’ve just discovered a strange problem that feels to be related to web pack or babel loading. (for the record we are on web pack 3 and the appropriate other plugins).

If we deploy a service completely all is well, doesn’t matter if its a fresh deploy or updating the entire stack. If however I deploy a function the deployment process ends successfully but we get (randomly) one of the following errors:

1. the function borks at import {}… OR states that a function (that is a function working wonderfully if we do a clean deploy) does not exist.

So it feels like this is webpack-serverless issue but Im stumped on it.

Anyone got this?

---

<div class="post-metadata">

**Author:** ![buggy](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/buggy/32/177_2.png) [@buggy](https://forum.serverless.com/u/buggy)\
**Post date:** [July 22, 2017, 6:49am UTC](https://forum.serverless.com/t/deploy-single-function-ends-in-runtime-errors-but-deploying-whole-service-is-fine-feels-like-a-web-pack-or-babel-issue/2339/2 "2017-07-22T06:49:44Z")

</div>

That second error (function only works after full deploy) sounds suspiciously like you’re making a change that requires cloud formation to be updated. Remember that deploying a function only updates the code, not the entire cloud formation.

It would help if you can provide the exact error messages you’re getting.

---

<div class="post-metadata">

**Author:** ![delprofundo](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/delprofundo/32/175_2.png) [@delprofundo](https://forum.serverless.com/u/delprofundo)\
**Post date:** [July 22, 2017, 3:05pm UTC](https://forum.serverless.com/t/deploy-single-function-ends-in-runtime-errors-but-deploying-whole-service-is-fine-feels-like-a-web-pack-or-babel-issue/2339/3 "2017-07-22T15:05:04Z")

</div>

nah just working inside the app code, haven’t modified the environment in days.

To replicate all I need to do is add a comment to any function and deploy that function and get this.

* * *

Syntax error in module ‘handler’: SyntaxError  
import { cwbRESify } from ‘./lib/representors/RESifier.representor.library’;  
^^^^^^  
SyntaxError: Unexpected token import  
at createScript (vm.js:56:10)  
at Object.runInThisContext (vm.js:97:10)  
at Module.\_compile (module.js:542:28)  
at Object.Module.\_extensions…js (module.js:579:10)  
at Module.load (module.js:487:32)  
at tryModuleLoad (module.js:446:12)  
at Function.Module.\_load (module.js:438:3)  
at Module.require (module.js:497:17)  
at require (internal/module.js:20:19)

so its saying no bueno on the import that works if i deploy the whole thing.

---

<div class="post-metadata">

**Author:** ![buggy](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/buggy/32/177_2.png) [@buggy](https://forum.serverless.com/u/buggy)\
**Post date:** [July 23, 2017, 7:42am UTC](https://forum.serverless.com/t/deploy-single-function-ends-in-runtime-errors-but-deploying-whole-service-is-fine-feels-like-a-web-pack-or-babel-issue/2339/4 "2017-07-23T07:42:25Z")

</div>

That error definitely looks like it’s uploading the source instead of compiling it.

---

<div class="post-metadata">

**Author:** ![delprofundo](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/delprofundo/32/175_2.png) [@delprofundo](https://forum.serverless.com/u/delprofundo)\
**Post date:** [August 28, 2017, 2:17pm UTC](https://forum.serverless.com/t/deploy-single-function-ends-in-runtime-errors-but-deploying-whole-service-is-fine-feels-like-a-web-pack-or-babel-issue/2339/5 "2017-08-28T14:17:57Z")

</div>

For what its worth, moved to 2.2.2 for serverless-webpack and add

package  
individually: true

to serverless.yml
