Deploy failure on Windows using default aws-csharp project
This is a Bug Report
Description
For bug reports:
-
What went wrong? I created a new serverless project, then tried to deploy the function without any modifications. 'sls deploy' failed because the deploy-package.zip is missing
-
What did you expect should have happened? The default function should have deployed to AWS
-
What was the config you used? Window Server 2012 aws-csharp template Region: us-east-1
-
What stacktrace or error message from your provider did you see? C:\Users\myusername\Documents\Visual Studio 2015\Projects\netcore_test2\src\netcore_ test2\lambda\upload>sls deploy -s csharpTestStage -r us-east-1 -v
Error --------------------------------------------------
ENOENT: no such file or directory, open 'C:\Users\myusername\Documents\Visual Studio 2015\Projects\netcore_test2\src\netcore_test2\lambda\upload\bin\Rele ase\netcoreapp1.0\publish\deploy-package.zip'
For debugging logs, run again after setting the "SLS_DEBUG=*" environment v ariable.
Stack Trace --------------------------------------------
Error: ENOENT: no such file or directory, open 'C:\Users\myusername\Documents\Visual
Studio 2015\Projects\netcore_test2\src\netcore_test2\lambda\upload\bin\Release
netcoreapp1.0\publish\deploy-package.zip'
at Error (native)
at Object.fs.openSync (fs.js:549:18)
at Object.fs.readFileSync (fs.js:397:15)
at AwsCompileFunctions.compileFunction (C:\Users\myusername\AppData\Roaming\npm
node_modules\serverless\lib\plugins\aws\deploy\compile\functions\index.js:167:24
)
at C:\Users\myusername\AppData\Roaming\npm\node_modules\serverless\lib\plugins\a
ws\deploy\compile\functions\index.js:212:39
at Array.forEach (native)
at AwsCompileFunctions.compileFunctions (C:\Users\myusername\AppData\Roaming\npm
\node_modules\serverless\lib\plugins\aws\deploy\compile\functions\index.js:212:8
)
at C:\Users\myusername\AppData\Roaming\npm\node_modules\serverless\lib\classes\P
luginManager.js:160:50
at tryCatcher (C:\Users\myusername\AppData\Roaming\npm\node_modules\serverless\n
ode_modules\bluebird\js\release\util.js:16:23)
at Object.gotValue (C:\Users\myusername\AppData\Roaming\npm\node_modules\serverl
ess\node_modules\bluebird\js\release\reduce.js:157:18)
at Object.gotAccum (C:\Users\myusername\AppData\Roaming\npm\node_modules\serverl
ess\node_modules\bluebird\js\release\reduce.js:144:25)
at Object.tryCatcher (C:\Users\myusername\AppData\Roaming\npm\node_modules\serve
rless\node_modules\bluebird\js\release\util.js:16:23)
at Promise._settlePromiseFromHandler (C:\Users\myusername\AppData\Roaming\npm\no
de_modules\serverless\node_modules\bluebird\js\release\promise.js:510:31)
at Promise._settlePromise (C:\Users\myusername\AppData\Roaming\npm\node_modules
serverless\node_modules\bluebird\js\release\promise.js:567:18)
at Promise._settlePromise0 (C:\Users\myusername\AppData\Roaming\npm\node_modules
\serverless\node_modules\bluebird\js\release\promise.js:612:10)
at Promise._settlePromises (C:\Users\myusername\AppData\Roaming\npm\node_modules
\serverless\node_modules\bluebird\js\release\promise.js:691:18)
Get Support -------------------------------------------- Docs: docs.serverless.com Bugs: github.com/serverless/serverless/issues
Please report this error. We think it might be a bug.
Your Environment Information ----------------------------- OS: win32 Node Version: 4.6.0 Serverless Version: 1.4.0
For feature proposals:
- What is the use case that should be solved. The more detail you describe this in the easier it is to understand for us.
- If there is additional config how would it look
Similar or dependent issues: *
Additional Data
-
Serverless Framework Version you're using: 1.4.0
-
Operating System: Windows Server 2012
-
Stack Trace:
-
Provider Error messages:
In contrast to python and js serverless projects, Java and C# projects have separate build steps, as described in the C# example (https://serverless.com/framework/docs/providers/aws/examples/hello-world/csharp/). It looks like you're on Windows. The example shown uses zip which is a Linux-flavored utility, but I just PR'd a script to do the same thing on Windows (#3019).
If you don't want to wait for that to be merged and released, you can just copy this script into the root of your serverless project and run it in a PowerShell console:
./build.ps1
Once the build is complete, serverless deploy should work : )
(If you don't want to use that script, you can manually zip them into that directory or use a utility such as 7zip on the command line)
Oh, or you could use this plugin which does the build as part of the deploy : )
https://github.com/fruffin/serverless-dotnet
@FLGMwt thanks for answering 👍 Yes, you need to build it before deployment.
Did this resolve your problem @crouffer ?
The serverless-dotnet plugin resolved this issue. Thanks for the help!