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
AWS -Still incorrect path when using $CODEBUILD_SRC_DIR #6964
Comments
@soelchma thanks for report. Can you show full output with |
I've the same issue as well, Once the script enters deployment stage in Pipeline everything seems to be fine, it uploads everything and generate the URL. but then it fails due to the same error with duplicating it's directories Also, even when I specify --package flag, serverless.yml keep looking for nodeModules.zip, which is my Layer directory inside .serverless and ignores that I've packaged it inside deployment_package. |
@ferasallaou Can you show full output with |
@medikoo Here you go
|
Also, this happens when I activate Layers in |
@ferasallaou thank you, I see it clearly now. Fix will be introduced shortly |
|
@medikoo and @ferasallaou thanks guys and sorry for coming back so late! |
@soelchma is there any expected date to solve this? I think it is a priority, I cannot complete Pipeline deployments because of this :( |
Hopefully patch will land next week |
@medikoo Any updates on this one? :( |
@ferasallaou I'm really sorry, other priorities took over this priority. Fix will definitely land (work on it has started), but at this point I cannot promise any specific release window |
@medikoo Ok thank you! |
Hi a workaround solution I found. So you can change your serverless deploy to: |
didn't work for me, the serverless-state.json still having the full path 🤷♂️ |
Any update on this? This is still an issue |
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 two lines 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. |
My Situation
I am using AWS CodeBuild and the newest Serverless Framework to build and deploy my Node.js application as a Lambda.
I package everything with
severless package --package /PATH/..
and store the artifacts under this path in a S3.In my deployment step I use the CODEBUILD_SRC_DIR to get the path/location of the current build artifacts which I want to deploy:
sls deploy --stage $env --package $CODEBUILD_SRC_DIR/target/$env -v -r eu-central-1
Problem
I get the following error:
Error: ENOENT: no such file or directory, open '/codebuild/output/src067167590/src/codebuild/output/src067167590/src/target/dev/serverless-state.json'
As you can see there seems to be something wrong with the path which I get back from $CODEBUILD_SRC_DIR . It doubles "/codebuild/output/src067167590" and therefore it cannot find the files.
Strange is when I do
echo $CODEBUILD_SRC_DIR
everything seems to be fine. Is it a problem with the commandsls deploy
?My Solution
Like the other guys mentioned I rolled also back to serverless 1.38. Then it works.
Is it sill not fixed ?
Thanks!
The text was updated successfully, but these errors were encountered: