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
No xxx.zip provided when trying to deploy package using CodePipeline/CodeBuild #9015
Comments
Hello @VincentHuysmans1, thanks for reporting. I've tried to reproduce your issue locally with a simplified version of your config but with no luck - in the approach you're using, you have to first package your functions with |
The package command:
The content of artifacts folder:
Packaging is done by another CodeBuild step inside CodePipeline. The full artifact folder is used as input for the deploy step. |
@pgrzesik Do you want me to provide some additional information? |
Hello @VincentHuysmans1 - I was just looking into it and trying to reproduce your issue but didn't manage to as of yet. The listing of |
It is listed right before the deploy statement. When I remove the individually packaging from the serverless.yml, everything works just fine. |
While searching for potential clues, I've found a similar issue that a few people experienced in the past as well - #6964 - unfortunately, it seems like the fix didn't make it. Could you try using one of the workarounds proposed that uses relative path instead of the absolute one with @medikoo As I see that you've been involved with the original issue - do you happen to remember what was the cause of it? |
@pgrzesik in #6964 bug was incorrect handling of I started working then on refactor #7009, and while refactoring handling of this option was relatively straightforward. I observed tens of tests being broken in many files, which drive me to conclusion that first those tests need to be refactored to On revisiting, I would first confirm whether same issue won't be fixed by solution proposed here: #7298 If it's the case, I would focus just on that. Otherwise I would revisit failing tests, and first ensure we have them moved to |
Thank you for insights @medikoo 🙇 I will dive a bit deep on that issue and see what I can find |
Hello @VincentHuysmans1 - thanks for patience here - unfortunatelly due to other priorities I won't be able to focus more on researching this issue during this week for sure - sorry about that. Did you try the proposed workaround from linked issue? Would that be an acceptable solution in the meantime? |
Hi @pgrzesik - you too thanks for the time you've already spend on investigating. I have not tested the workaround yet, but I will try it today and come back at it. |
Thanks @VincentHuysmans1 - too bad that the workaround didn't help in this case - I'll try to dive deeper into that issue hopefully next week and report back with findings. |
Do we have any news about this issue? |
Hello @ghostjester - unfortunately, due to other priorities I wasn't yet able to investigate it further. |
Hello @VincentHuysmans1 and @ghostjester - I've managed to find some time to investigate further but when using your specific example @VincentHuysmans1 I didn't manage to reproduce this issue locally. Are you able to deploy if you do following:
? I'm trying to exclude any issues related with how CODEBUILD extracts the cached artifacts, so that information would be really helpful. Also, thanks a lot for patience, unfortunately a lot of other priorities came up which didn't let me to focus on this one. |
Hi @pgrzesik. I am experiencing the same issue and came across this looking for a solution. I am using AWS CodePipeline to Build and then Deploy the solution. It is breaking up the packages and building correctly, but the Deploy process is failing - stating that the .zip file is not there for the individual packages, but I can confirm it is in that directory. I have traced it to an invalid path in the serverless-state.json file, and attempting to do a sed command to change the path to what it needs to be. I'll let you know if I can find a workaround, which may help implement a fix. |
For anyone else experiencing this issue, I finally identified the root cause and a simple workaround. In summary, the "artifact" incorrectly has "$CODEBUILD_SRC_DIR" in the value. Also, the srcxxxxxxxxxx number changes between deploy and build, so you can't just do a find/replace for the exact string in DEPLOY since the value is the $CODEBUILD_SRC_DIR that was in BUILD. For each function in the serverless-state.json, you will see an artifact property that looks similar to: To work around this issue, I simply added the following line in my BUILD commands, immediately above the 'serverless deploy ...' statement.
Note: I am using the '${!stage}' value in my code, but this may be different in your implementation - probably $ENV. This will transform the "/codebuild/output/src887072543/src/.serverless/function.zip" statements to ".serverless/function.zip", allowing the deploy process to find the file without error. This took me a while to figure out, so I hope it helps others that may be experiencing the same issue. |
Hi @pgrzesik @jplandry908 Im facing the same issue. I am using azure pipeline to package and deploy artifacts, packaging and deploying in different azure pipeline agents so its getting this issue. For each function in the serverless-state.json, I can see the the artifact that look similar to: Installed Version
|
Hi @pessrini. If you are having the same issue that I was having, then you need to strip out the So in your example, you have: And it should look like: Using the sed command, you can remove all text from two strings using the following command: So instead of the command I specified above, for your situation try: The |
@pgrzesik and others, I ran into what I think is the same issue, and I can reproduce it consistently in my local dev (as well as in the CI/CD where it originally happened). I switched our local stack to use Our stack:
If you look at the state file of the built package, it contains the FULL PATH of the zip file under each function entry:
I compared this with the state file before we upgraded to serverless-esbuild (were using serverless-webpack) and there we had a relative path as artifact:
The code that's processing the deploy extracts the artifactFilePath from the package.artifact property, therefore getting an absolute path there which in the case of CI/CD systems, may not be the same between package and deploy. I will report an issue to the |
I'm trying to deploy a serverless app with two functions using CodeBuild. In the serverless.yml I used settings for packaging individually with includes and excludes. When I remove these settings from the yaml file, everything runs perfectly. Because we are going to add a lot more functions in the future we really need this functionality to work with AWS CodeBuild.
I feel like this is somehow related to this bug which is closed recently: #4720
serverless.yml
serverless deploy --stage $ENV --package $CODEBUILD_SRC_DIR/artifacts/$ENV -v
outputInstalled version
The text was updated successfully, but these errors were encountered: