-
Notifications
You must be signed in to change notification settings - Fork 78
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
Error on mdapi:deploy asking for location of "server.key" #124
Comments
@nutchanon-pho Thank you, we are tracking this bug internally as it has been reported a few times. The internal work number is W-6086098. |
@nutchanon-pho Can you add |
Are there any work arounds for this issue? This also affects the force:org:create command |
@twaugh2020 Here is the Know Issue https://success.salesforce.com/issues_view?id=a1p3A000001SGxLQAW |
Hi, |
Hi I've just encountered this. No changes to my jenkins file throughout the day while there were successful deployments earlier in the day. I did perform some git maintenance (merge ins from master), but shouldn't have affected Jenkins itself. One thing I noticed in output is it's trying to pull in data from a directory unrelated to the job. For example, I'm running a multi-branch Pipe that has base directory X_Partial. Jenkins is trying to reference the key file from another job titled X-Sandbox@tmp. I would expect it to pull in from X_Partial@tmp?? This is a big deal for me as it stops my ability to do any deployments. Hoping I can get to a resolution fast. |
What I did to resolve this issue is putting the jwt key files inside the repository to be persistently referenced by the Jenkinsfile. This approach is highly not recommended as it is not secured. It is meant to be a workaround. |
I did encountered something like this which is really unexpected and I suspected it might have something to do with Jenkins' way of handling files and caches itself. Try what I recommended above on moving the JWT files inside the repository not the Jenkins. After that, try uninstalling the SFDX CLI following the steps here https://developer.salesforce.com/docs/atlas.en-us.sfdx_setup.meta/sfdx_setup/sfdx_setup_uninstall.htm Then, try your deployment again. |
That's the last thing I want to do!! I will need to do something to move forward though. I will need to revisit tomorrow. Thanks for the pointers. |
That's the same thing i have started encountering, even deleting the previous project which it is referring does not resolve the issue. |
Now that(I think) cache has cleared, i am receiving below error: An internal server error has occurred
An error has occurred while processing your request. The salesforce.com support team has been notified of the problem. If you believe you have additional information that may be of help in reproducing or correcting the error, please contact
|
Adding the key to repository doesn't work when I use Jenkins. I have to log in to the CLI and perform the SFDX commands manually. Jenkins is the problem here. There's nothing I can do to overcome this at this time other than performing a fresh install of Jenkins I believe. It's Jenkins that's trying to reference a file in a place that doesn't exist. This really sucks. |
You have to log out of the org you are authenticating to at the end of the Jenkins job and when the job starts you have to log in to authenticate. When you log out and log back in it forces jenkins to generate a new path to the JWT Key File. Here is an example that fixed this issue for me: stages {
|
I've tried a couple versions of this, none of which produce the actual logout command AFTER it errors out. Perhaps I need a better understanding of the groovy syntax, but this just isn't working for me. I expanded on the groovy code put out by salesforce.com in the JWT Jenkins CI documentation. I'm not doing much else other than this. Any thoughts on how to force a log out? This script still produces this end result as of a moment ago: `#!groovy
}` |
It's frustrating.I have been into it since long.tried everything.Tried what you had said but still the same error.
} |
Yes it is frustrating that one day a script works and the next it doesn't when no changes were made to infrastructure and/or scripts. This is definitely an infrastructure issue specific to SFDX/Jenkins, IMHO. I'm very disappointed/frustrated to be going through this. I don't need to be spending time on this after having just moved my whole Jenkins architecture from ANT to SFDX in October 2019 because of the Eclipse retirement. I thought I was normalized and this was in the past. Apparently not. Scripts written and tested in October were working fine up until yesterday. There has to be a reason for this. It's unacceptable that my primary deployment tool is now a glorified web server with SFDX installed. If SFDX requires a log out, then the sample script provided by salesforce.com should include just that. Jenkins right now is a brick and unusable for my practice. |
The fix for this issue will be included in the patch release this Thursday, 1/9/2020. Apologies for the delay in getting the fix out and for all the CI headaches it's caused! |
I just cant believe it..i uninstalled Jenkins completely and installed it afresh with all the plugins and error still refers to the old directory that even my memory does not remember. :\Program Files (x86)\Jenkins\workspace\Iberia_RM_Salesforce_>"C:\Program Files\Salesforce CLI\bin"sfdx force:auth:jwt:grant --clientid 3MVG9od6vNol.eMoqx7 --username [email protected] --jwtkeyfile "****" --setdefaultdevhubusername --instanceurl https://test.salesforce.com C:\Program Files (x86)\Jenkins\workspace\Iberia_RM_Salesforce_>"C:\Program Files\Salesforce CLI\bin"sfdx force:mdapi:deploy -d force-app/main/default/classes -u [email protected] |
Can somebody please let me know the logic why jenkins is looking for server.key on that folder when i have uploaded it on Jenkins as global variable? |
I believe this is the bug you’re seeing. I didn’t have any issues with my key being in a secret file referenced in script prior to this week. Something changed inside SFDX causing scripts to fail.
From: PseudoDarwinist <[email protected]>
Reply-To: forcedotcom/cli <[email protected]>
Date: Thursday, January 9, 2020 at 3:02 AM
To: forcedotcom/cli <[email protected]>
Cc: cumulus-robert <[email protected]>, Comment <[email protected]>
Subject: Re: [forcedotcom/cli] Error on mdapi:deploy asking for location of "server.key" (#124)
Can somebody please let me know the logic why jenkins is looking for server.key on that folder when i have uploaded it on Jenkins as global variable?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
The ONLY workaround I’ve been able to put in is revert back to my ANT scripts for deployments. ANT still works great and was what I was using for CI prior to Oct-19. The challenge here is ANT uses username/password/token and SFDX uses OAUTH JWT Headless. You’d have to have two sets of credentials in Jenkins for the interim until this gets resolved.
Nothing else, no other feedback provided here allows the SFDX script to work again in my case. It just worked one day and stopped working the next. Unacceptable in my eyes, but at least I’m no longer dead in the water.
From: PseudoDarwinist <[email protected]>
Reply-To: forcedotcom/cli <[email protected]>
Date: Thursday, January 9, 2020 at 3:02 AM
To: forcedotcom/cli <[email protected]>
Cc: cumulus-robert <[email protected]>, Comment <[email protected]>
Subject: Re: [forcedotcom/cli] Error on mdapi:deploy asking for location of "server.key" (#124)
Can somebody please let me know the logic why jenkins is looking for server.key on that folder when i have uploaded it on Jenkins as global variable?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Was the patch deployed?It was supposed to be on Thursday!! |
I'm curious too. I just ran 'sfdx update' and says I'm on latest
version.Just ran my pipeline in Jenkins and continue to receive the error.
ERROR running force:mdapi:deploy: ENOENT: no such file or directory, open
…On Fri, Jan 10, 2020 at 12:28 AM PseudoDarwinist ***@***.***> wrote:
The fix for this issue will be included in the patch release this
Thursday, 1/9/2020. Apologies for the delay in getting the fix out and for
all the CI headaches it's caused!
Was the patch deployed?It was supposed to be on Thursday!!
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#124?email_source=notifications&email_token=AB6JAJM4K76OJKGDGW4DOXLQ5AWT5A5CNFSM4H4B3KT2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEITC2NI#issuecomment-572927285>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AB6JAJK7R7GQYIZ2RB55IITQ5AWT5ANCNFSM4H4B3KTQ>
.
--
*Robert Brown*
Senior Consultant
www.cumulusvision.com
Direct 415.463.1202
25 Taylor Street | San Francisco | CA | 94102
|
@cumulus-robert @PseudoDarwinist, we are currently fixing the build for our installers that is causing an issue with |
Was it fixed?Do i need to uninstall my CLI and install it again because i keep receiving the same error. |
Is this resolved yet. I am still facing the same error message . Do we need to uninstall CLI and reinstall ?Also I face this error message only for a deployment to a certain SF instance and not any other instance. |
I got to say this is pretty disappointing. To have built a solution based on salesforce.com telling me I was losing Eclipse and Visual Studio is the way to go AND oh by the way it’s in a completely different format so you have to reorganize stuff AND here’s the tools (SFDX) to do so. I migrated our whole Jenkins instance using these tools. As a consultant operating with 10+ organizations, the only way I’m efficient is using Jenkins. This really broke the way we do things and to this day is continuing to cause me problems. The fact that this still does not work to this day and I’ve had to regress back to my old ANT scripts is frustrating to say the least. I’m faced with reverting back to my ANT scripts on less of a workaround basis until Salesforce.com can confidently say this has been resolved with step by step instructions to perform such resolution.
To add to this, the issue seems to be project specific. I’ve identified one of the orgs I support which is able to run: sfdx force:source:retrieve -p $WORKSPACE/force-app/main/default/ -u $username. This commands works just fine on one project, but get this error on another using the same command. Because of this, I’m unconvinced root cause has been identified at this time. I’m not convinced SFDX should be used inside Jenkins until this is fully resolved. Is this a wider spread issue? Is this happening ONLY on Jenkins? Are other pipeline tools experiencing same issue?
Is Jenkins really the issue here and not SFDX? How many other people here continue to be unable to use SFDX with their Jenkins instance?
From: karanjakrpushkar <[email protected]>
Reply-To: forcedotcom/cli <[email protected]>
Date: Monday, January 13, 2020 at 4:45 AM
To: forcedotcom/cli <[email protected]>
Cc: cumulus-robert <[email protected]>, Mention <[email protected]>
Subject: Re: [forcedotcom/cli] Error on mdapi:deploy asking for location of "server.key" (#124)
Is this resolved yet. I am still facing the same error message . Do we need to uninstall CLI and reinstall ?Also I face this error message only for a deployment to a certain SF instance and not any other instance.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
This continues to be a problem for me. This morning I thought there was progress because jobs that were previously failing started working again. When I started to go remove my workarounds one by one, I found that other jobs were still failing and some weren't. Same behavior as my last comment. I can run the exact same 'retrieve' command on a job having the exact same jenkins config. I created a new one off of the one that was working just to confirm while only changing repository and credential details, leaving script and build steps untouched. There is nothing special about this script. It's just doing a source retrieve. The issue I have simply is the source retrieve works on one project and not the other.
Is anyone else continuing to have a problem? |
@cumulus-robert, I am so sorry that this is still happening. Is it the exact same error? Are you on CLI version sfdx-cli 7.42.1 and salesforcedx 47.15.0? |
Hi @clairebianchi - Yes, same error. I had updated version last week to 7.41.0. I just updated version again and confirmed it is now 7.42.1. I can confirm too that salesforcedx is version 47.15. I built these two job right now on version 7.42.1. One works and one doesn't. Same script, different Jenkins project. Different repository. Note on the failure how it is looking for a key file in a completely different location than the current project. This is the same behavior as when I first encountered this problem at the beginning of the month. No change to my infrastructure and had been working fine prior to December/January. |
I'm late to this thread but I'm hoping I can provide some additional context and help to get to the bottom of this. The Salesforce CLI stores all authentication in the Can someone try to set the HOME directory to the Jenkins workspace at the beginning of the job?
Then use it like you do
If that turns out to be the problem, maybe the CLI can also provide additional options to store auth files in a specific location something similar. |
My issue has been resolved with the feedback of ensuring scripts are setting home environment local to the job vs. global home environment. Wrapping my 'With credentials' groovy script with:
For Jenkins jobs outside of pipeline, adding home environment specification (export HOME=$WORKSPACE) to the script fixed my outside Jenkins jobs:
Thank you to @clairebianchi and team for taking the time to review and ultimately resolve my issue. |
@cumulus-robert thank you for the update. We are updating our Jenkins documentation with this information. I am going to close this issue now. |
How would fix the below script. I am still receiving the error.I have tried exporting workspace but i think i am doing it wrong.
} |
try this: `#!groovy def BUILD_NUMBER=env.BUILD_NUMBER def HUB_ORG=env.HUB_ORG_DH println 'KEY IS' stage('checkout source') { withEnv(["HOME=${env.WORKSPACE}"]) {
} |
Uggghh..Still the same error :( C:\Program Files (x86)\Jenkins\workspace\LocalJenkins_>"C:\Program Files\Salesforce CLI\bin\sfdx" force:mdapi:deploy -d manifest/. -u niit.csingh |
used this script: def BUILD_NUMBER=env.BUILD_NUMBER def HUB_ORG=env.HUB_ORG_DH println 'KEY IS' stage('checkout source') { withEnv(["HOME=${env.WORKSPACE}"]) { withCredentials([file(credentialsId: JWT_KEY_CRED_ID, variable: 'jwt_key_file')]) {
} |
hi @clairebianchi -- this issue crept back up for me. I had to rebuild my Jenkins server, but was sure to install sfdx 47.15.0 during rebuild. This was the version that scripts worked on before the rebuild. Now with the same scripts prior to the rebuild, I'm getting this:
robert@jenkins-4-vm:~$ sfdx plugins --core The environment variables still exist that were added February. Is there any other details than can be shared to potentially overcome this? This is a new Jenkins instance on Google Cloud Console Marketplace, Jenkins Certified by Bitnami. The previous instance was the same. |
@clairebianchi - Sorry for false alarm. Was worried I'd be in another month long no Jenkins scenario at first. It seems there was opportunity in order of operations. I think because I have to install SFDX first with current version, then revert to previous version, any Jenkins project created while on current version needed to be deleted. I deleted my projects and recreated. It seems to be working again. It is interesting however, that the default install of SFDX is producing this same behavior with Jenkins again, even with the environment variables being set for linux. |
Hi @clairebianchi - I want to mention that I continue to have issues with the previous comment. Every day now, I have to reset pipes inside Jenkins because of this failure: sfdx force:mdapi:deploy --wait 120 -c --deploydir /opt/bitnami/jenkins/jenkins_home/workspace/TAN-pipe_prod_validate/mdapi --targetusername [email protected] --testlevel RunLocalTests Because I have a workaround (deleting and recreating project), it's not urgent but do want to figure out as I have have to delete and recreate projects every day now inside Jenkins. I'm struggling to understanding why this is happening. Has anyone seen anything like this. It can be recreated daily. Is there any additional pointers you or team have to address this? |
@cumulus-robert can you open a new issue and reference this one? That will bubble this up to the top and we can take a look. I have not heard of this happening to anyone else, sorry it is an issue again. |
@clairebianchi /usr/local/bin/sfdx force:mdapi:deploy --targetusername jenkins@deloitte_sf_project.com.test --deploydir mdapi/target/src --testlevel RunLocalTests --json --ignorewarnings |
Can anyone let me know what is final resolution for the issue ?? |
@clairebianchi can you please let me know what is the final solution for the issue as its very very urgent for me to solve the below error |
@pawan22sfdl @ThomasCreemers This ticket is closed. You may want to either create a new one for yourself and/or add to the one I created the other day (#363). This is actually the second time in 3 months I've experienced this issue with Jenkins/SFDX. It seems to me there are environmental issues with SFDX. I'm getting nowhere with Jenkins / Bitnami. Everything leads to SFDX being the culprit. I'm about to go back to my ANT solution in Jenkins as SFDX is still not ready for continuous integration, IMHO. Or, at very least platform testing for solutions like Jenkins (or other pipeline tools) isn't rigorous enough prior to a new SFDX version release. I had to go back to version SFDX version 47.0.15 as the default install of SFDX WILL NOT work. I immediately get this error. If I go back to version 47.0.15, I at least have a partially working solution. I can go a day without getting the error, but then have to perform maintenance on Jenkins server in order for scripts to work again. |
Doing the following fixed this issue for me:
|
Summary
I have set up a Jenkins pipeline to automatically deploy to orgs using sfdx cli.
The errors which I have been having recently (they just started to happen since 21st May) is
The authentication to the target org, which will always be performed as the first step for every pipeline job, was fine according to the log.
JWT keyfile is supplied using
withCredentials
in this context.The only workaround we could do is to uninstall sfdx and reinstall it and everything will work fine for a period of time before this error started coming up again.
Steps To Reproduce:
Remark: I only pasted a snippet of the problematic code here not the full code, because the full code would contain references to libraries and steps which are unique to my Jenkins environment.
Expected result
The mdapi:deploy command should work properly without errors.
Actual result
The command failed with the error above without even reaching to Salesforce org.
Additional information
Feel free to attach a screenshot.
SFDX CLI Version sfdx-cli/7.13.0-27dbcb37d3 linux-x64 node-v10.15.3
The text was updated successfully, but these errors were encountered: