Skip to content
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 (JwtGrantError): We encountered a JSON web token error, which is likely not an issue with Salesforce CLI. Here’s the error: TypeError::Cannot read properties of undefined (reading 'setContentsFromObject') #3201

Closed
gian-ribo opened this issue Jan 30, 2025 · 7 comments
Labels
investigating We're actively investigating this issue validated Version information for this issue has been validated

Comments

@gian-ribo
Copy link

A strange error occurs during command sf org login jwt --client-id *** --jwt-key-file "JWT/server.key" --username ***

I use it in a script on a remote linux machine. Before login, script executes also the command npm install @salesforce/cli --location=global to update cli.

Scripts works till 23 January 2025 (cli version 2.73.9), today stops working (cli version 2.74.6). I tried to downgrade version but the error still

"Error (JwtGrantError): We encountered a JSON web token error, which is likely not an issue with Salesforce CLI. Here’s the error: TypeError::Cannot read properties of undefined (reading 'setContentsFromObject')"

env before 23 January 2025 (WORKING):

{

98 | "architecture": "linux-x64",
99 | "cliVersion": "@salesforce/cli/2.73.9",
100 | "nodeVersion": "node-v20.14.0",
101 | "osVersion": "Linux 4.14.355-271.569.amzn2.x86_64",
102 | "rootPath": "/usr/local/lib/node_modules/@salesforce/cli",
103 | "shell": "bash",
104 | "pluginVersions": [
105 | "@oclif/plugin-autocomplete 3.2.17 (core)",
106 | "@oclif/plugin-commands 4.1.16 (core)",
107 | "@oclif/plugin-help 6.2.21 (core)",
108 | "@oclif/plugin-not-found 3.2.35 (core)",
109 | "@oclif/plugin-plugins 5.4.25 (core)",
110 | "@oclif/plugin-search 1.2.18 (core)",
111 | "@oclif/plugin-update 4.6.23 (core)",
112 | "@oclif/plugin-version 2.2.20 (core)",
113 | "@oclif/plugin-warn-if-update-available 3.1.30 (core)",
114 | "@oclif/plugin-which 3.2.25 (core)",
115 | "@salesforce/cli 2.73.9 (core)",
116 | "apex 3.6.8 (core)",
117 | "api 1.3.3 (core)",
118 | "auth 3.6.87 (core)",
119 | "data 4.0.1 (core)",
120 | "deploy-retrieve 3.17.7 (core)",
121 | "info 3.4.32 (core)",
122 | "limits 3.3.44 (core)",
123 | "marketplace 1.3.7 (core)",
124 | "org 5.2.23 (core)",
125 | "packaging 2.9.12 (core)",
126 | "schema 3.3.46 (core)",
127 | "settings 2.4.10 (core)",
128 | "sobject 1.4.49 (core)",
129 | "telemetry 3.6.29 (core)",
130 | "templates 56.3.35 (core)",
131 | "trust 3.7.55 (core)",
132 | "user 3.6.6 (core)",
133 | "sfdmu 4.38.0 (user) published 25 days ago (Sun Dec 29 2024)",
134 | "sfdx-git-delta 5.52.0 (user) published 30 days ago (Mon Dec 23 2024) (latest is 6.2.0)"
135 | ]
136 | }

env today 30 January 2025 with last version (NOT WORKING):

{

99 | "architecture": "linux-x64",
100 | "cliVersion": "@salesforce/cli/2.74.6",
101 | "nodeVersion": "node-v20.18.1",
102 | "osVersion": "Linux 4.14.355-275.570.amzn2.x86_64",
103 | "rootPath": "/usr/local/lib/node_modules/@salesforce/cli",
104 | "shell": "bash",
105 | "pluginVersions": [
106 | "@oclif/plugin-autocomplete 3.2.18 (core)",
107 | "@oclif/plugin-commands 4.1.17 (core)",
108 | "@oclif/plugin-help 6.2.22 (core)",
109 | "@oclif/plugin-not-found 3.2.37 (core)",
110 | "@oclif/plugin-plugins 5.4.26 (core)",
111 | "@oclif/plugin-search 1.2.19 (core)",
112 | "@oclif/plugin-update 4.6.26 (core)",
113 | "@oclif/plugin-version 2.2.20 (core)",
114 | "@oclif/plugin-warn-if-update-available 3.1.31 (core)",
115 | "@oclif/plugin-which 3.2.26 (core)",
116 | "@salesforce/cli 2.74.6 (core)",
117 | "apex 3.6.8 (core)",
118 | "api 1.3.3 (core)",
119 | "auth 3.6.87 (core)",
120 | "data 4.0.1 (core)",
121 | "deploy-retrieve 3.17.7 (core)",
122 | "info 3.4.32 (core)",
123 | "limits 3.3.44 (core)",
124 | "marketplace 1.3.7 (core)",
125 | "org 5.2.23 (core)",
126 | "packaging 2.9.12 (core)",
127 | "schema 3.3.46 (core)",
128 | "settings 2.4.10 (core)",
129 | "sobject 1.4.49 (core)",
130 | "telemetry 3.6.29 (core)",
131 | "templates 56.3.35 (core)",
132 | "trust 3.7.55 (core)",
133 | "user 3.6.6 (core)",
134 | "sfdmu 4.38.0 (user) published 32 days ago (Sun Dec 29 2024)",
135 | "sfdx-git-delta 5.52.0 (user) published 37 days ago (Mon Dec 23 2024) (latest is 6.2.1)"
136 | ]
137 | }

env today 30 January 2025 with 2.73.9 version (NOT WORKING):

{

102 | "architecture": "linux-x64",
103 | "cliVersion": "@salesforce/cli/2.73.9",
104 | "nodeVersion": "node-v20.18.1",
105 | "osVersion": "Linux 4.14.355-275.570.amzn2.x86_64",
106 | "rootPath": "/usr/local/lib/node_modules/@salesforce/cli",
107 | "shell": "bash",
108 | "pluginVersions": [
109 | "@oclif/plugin-autocomplete 3.2.17 (core)",
110 | "@oclif/plugin-commands 4.1.16 (core)",
111 | "@oclif/plugin-help 6.2.21 (core)",
112 | "@oclif/plugin-not-found 3.2.35 (core)",
113 | "@oclif/plugin-plugins 5.4.25 (core)",
114 | "@oclif/plugin-search 1.2.18 (core)",
115 | "@oclif/plugin-update 4.6.23 (core)",
116 | "@oclif/plugin-version 2.2.20 (core)",
117 | "@oclif/plugin-warn-if-update-available 3.1.30 (core)",
118 | "@oclif/plugin-which 3.2.25 (core)",
119 | "@salesforce/cli 2.73.9 (core)",
120 | "apex 3.6.8 (core)",
121 | "api 1.3.3 (core)",
122 | "auth 3.6.87 (core)",
123 | "data 4.0.1 (core)",
124 | "deploy-retrieve 3.17.7 (core)",
125 | "info 3.4.32 (core)",
126 | "limits 3.3.44 (core)",
127 | "marketplace 1.3.7 (core)",
128 | "org 5.2.23 (core)",
129 | "packaging 2.9.12 (core)",
130 | "schema 3.3.46 (core)",
131 | "settings 2.4.10 (core)",
132 | "sobject 1.4.49 (core)",
133 | "telemetry 3.6.29 (core)",
134 | "templates 56.3.35 (core)",
135 | "trust 3.7.55 (core)",
136 | "user 3.6.6 (core)",
137 | "sfdmu 4.38.0 (user) published 32 days ago (Sun Dec 29 2024)",
138 | "sfdx-git-delta 5.52.0 (user) published 37 days ago (Mon Dec 23 2024) (latest is 6.2.1)"
139 | ]
140 | }

OUTPUT with warning
› Warning: @salesforce/cli update available from 2.73.9 to 2.74.6.

158 | Error (JwtGrantError): We encountered a JSON web token error, which is likely not an issue with Salesforce CLI. Here’s the error: TypeError::Cannot read properties of undefined (reading 'setContentsFromObject')

@gian-ribo gian-ribo added the investigating We're actively investigating this issue label Jan 30, 2025
Copy link

Thank you for filing this issue. We appreciate your feedback and will review the issue as soon as possible. Remember, however, that GitHub isn't a mechanism for receiving support under any agreement or SLA. If you require immediate assistance, contact Salesforce Customer Support.

@github-actions github-actions bot added the validated Version information for this issue has been validated label Jan 30, 2025
@WillieRuemmele
Copy link
Member

hi @gian-ribo - I think you might've proved that it's not a CLI issue, since downgrading to the older, working version, still threw the same error.

have you verified nothing has changed to your connected app, or other settings in the org that could cause this to fail, regardless of CLI version?

@gian-ribo
Copy link
Author

hi @gian-ribo - I think you might've proved that it's not a CLI issue, since downgrading to the older, working version, still threw the same error.

have you verified nothing has changed to your connected app, or other settings in the org that could cause this to fail, regardless of CLI version?

yes, nothing changed on connected app

@gian-ribo
Copy link
Author

in addition: if I execute command from my local machine terminal it works... no sense

@WillieRuemmele
Copy link
Member

I've noticed your node version changes between working/broken versions, try reverting back to node-v20.14.0?

@gian-ribo
Copy link
Author

I've noticed your node version changes between working/broken versions, try reverting back to node-v20.14.0?

I tried just now:

› Warning: @salesforce/cli update available from 2.73.9 to 2.74.6.
Error (JwtGrantError): We encountered a JSON web token error, which is likely not an issue with Salesforce CLI. Here’s the error: TypeError::Cannot read properties of undefined (reading 'setContentsFromObject')

{

104 | "architecture": "linux-x64",
105 | "cliVersion": "@salesforce/cli/2.73.9",
106 | "nodeVersion": "node-v20.14.0",
107 | "osVersion": "Linux 4.14.355-275.572.amzn2.x86_64",
108 | "rootPath": "/usr/local/lib/node_modules/@salesforce/cli",
109 | "shell": "bash",
110 | "pluginVersions": [
111 | "@oclif/plugin-autocomplete 3.2.17 (core)",
112 | "@oclif/plugin-commands 4.1.16 (core)",
113 | "@oclif/plugin-help 6.2.21 (core)",
114 | "@oclif/plugin-not-found 3.2.35 (core)",
115 | "@oclif/plugin-plugins 5.4.25 (core)",
116 | "@oclif/plugin-search 1.2.18 (core)",
117 | "@oclif/plugin-update 4.6.23 (core)",
118 | "@oclif/plugin-version 2.2.20 (core)",
119 | "@oclif/plugin-warn-if-update-available 3.1.30 (core)",
120 | "@oclif/plugin-which 3.2.25 (core)",
121 | "@salesforce/cli 2.73.9 (core)",
122 | "apex 3.6.8 (core)",
123 | "api 1.3.3 (core)",
124 | "auth 3.6.87 (core)",
125 | "data 4.0.1 (core)",
126 | "deploy-retrieve 3.17.7 (core)",
127 | "info 3.4.32 (core)",
128 | "limits 3.3.44 (core)",
129 | "marketplace 1.3.7 (core)",
130 | "org 5.2.23 (core)",
131 | "packaging 2.9.12 (core)",
132 | "schema 3.3.46 (core)",
133 | "settings 2.4.10 (core)",
134 | "sobject 1.4.49 (core)",
135 | "telemetry 3.6.29 (core)",
136 | "templates 56.3.35 (core)",
137 | "trust 3.7.55 (core)",
138 | "user 3.6.6 (core)",
139 | "sfdmu 4.38.0 (user) published 32 days ago (Sun Dec 29 2024)",
140 | "sfdx-git-delta 5.52.0 (user) published 37 days ago (Mon Dec 23 2024) (latest is 6.2.1)"
141 | ]
142 | }

@gian-ribo
Copy link
Author

I solved with add on the pipeline script (AWS codeBuild)

SF_USE_GENERIC_UNIX_KEYCHAIN=true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
investigating We're actively investigating this issue validated Version information for this issue has been validated
Projects
None yet
Development

No branches or pull requests

2 participants