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

Node js deprecation warning coming along with sf org login command #2570

Closed
shabu74 opened this issue Nov 15, 2023 · 32 comments
Closed

Node js deprecation warning coming along with sf org login command #2570

shabu74 opened this issue Nov 15, 2023 · 32 comments
Labels
investigating We're actively investigating this issue more information required Issue requires more information or a response from the customer validated Version information for this issue has been validated

Comments

@shabu74
Copy link

shabu74 commented Nov 15, 2023

Summary

I am using sf org login sfdx-url command in my gitlab yml script. For a couple of days I am getting a node js deprecation warning along with that command. (node:280) [DEP0137] DeprecationWarning: Closing a FileHandle object on garbage collection is deprecated. Please close FileHandle objects explicitly using FileHandle.prototype.close(). In the future, an error will be thrown if a file descriptor is closed during garbage collection.

Steps To Reproduce

  • Run the command in gitlab yml script

Expected result

Successful authentication with out any warning

Actual result

(node:280) [DEP0137] DeprecationWarning: Closing a FileHandle object on garbage collection is deprecated. Please close FileHandle objects explicitly using FileHandle.prototype.close(). In the future, an error will be thrown if a file descriptor is closed during garbage collection.

System Information

{
"architecture": "linux-x64",
"cliVersion": "@salesforce/cli/2.16.10",
"nodeVersion": "node-v19.9.0",
"osVersion": "Linux 5.15.0-1049-aws",
"rootPath": "/usr/local/lib/node_modules/@salesforce/cli",
"shell": "bash",
"pluginVersions": [
"@oclif/plugin-autocomplete 3.0.1 (core)",
"@oclif/plugin-commands 3.0.5 (core)",
"@oclif/plugin-help 6.0.5 (core)",
"@oclif/plugin-not-found 3.0.2 (core)",
"@oclif/plugin-plugins 4.1.4 (core)",
"@oclif/plugin-search 1.0.5 (core)",
"@oclif/plugin-update 4.1.3 (core)",
"@oclif/plugin-version 2.0.4 (core)",
"@oclif/plugin-warn-if-update-available 3.0.2 (core)",
"@oclif/plugin-which 3.0.7 (core)",
"@salesforce/cli 2.16.10 (core)",
"apex 2.3.20 (core)",
"auth 2.8.25 (core)",
"data 2.6.1 (core)",
"deploy-retrieve 1.19.3 (core)",
"info 2.6.51 (core)",
"limits 2.3.41 (core)",
"login 1.2.40 (core)",
"marketplace 0.3.2 (core)",
"org 2.11.7 (core)",
"schema 2.3.32 (core)",
"settings 1.4.37 (core)",
"sobject 0.2.14 (core)",
"source 2.10.46 (core)",
"telemetry 2.3.8 (core)",
"templates 55.5.17 (core)",
"trust 3.0.2 (core)",
"user 2.3.41 (core)"
]
}

@shabu74 shabu74 added the investigating We're actively investigating this issue label Nov 15, 2023
@github-actions github-actions bot added the validated Version information for this issue has been validated label Nov 15, 2023
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.

@mshanemc
Copy link
Contributor

Node 19 is not supported (by node) so we don't support it either.

Can you repro this on a supported node version (currently 18, 20, 21?)

@mshanemc mshanemc added the more information required Issue requires more information or a response from the customer label Nov 15, 2023
@shabu74
Copy link
Author

shabu74 commented Nov 15, 2023

@mshanemc hi mate, I tried every version including latest. What I am saying is problem is not with my node image. The problem is inside sf login cli command. I have a lot of touch commans and file writing in my yml. It is working perfectly without any warning. But, it gives warning only for login command. That means, there is something wrong inside sf login command.

@mshanemc
Copy link
Contributor

I'm able to run the command without seeing the error.

Can you provide a way to replicate the issue that doesn't involve using your CI or node19?
The step Run the command in gitlab yml script makes it hard to replicate? Maybe some simplified version of your script that still fails when not run from gitlab?

@shabu74
Copy link
Author

shabu74 commented Nov 16, 2023

@mshanemc

Script without sf org login command

function test_script() {
install_salesforce_cli

#sf org login sfdx-url --sfdx-url-file $TEST_FILE --alias "MyOrg"

touch authurl.info
echo "test" > authurl.info


echo_method_comment "Comment after sf authentication"

}

Output

$ test_script
install_salesforce_cli Installing Salesforce CLI...
11:15:13.131 | Installing sf...
install_salesforce_cli Successfully installed Salesforce CLI.
11:15:38.691 | Comment after sf authentication
Saving cache for successful job
00:01
Creating cache main-2-protected...
WARNING: node_modules/: no matching files. Ensure that the artifact path is relative to the working directory (/builds/salesforce/caresnsw)
.sfdx/: found 2 matching artifact files and directories
Archive is up to date!
Created cache
Cleaning up project directory and file based variables
00:00
Job succeeded

Script with sf org login command

function test_script() {
install_salesforce_cli

sf org login sfdx-url --sfdx-url-file $TEST_FILE --alias "MyOrg"

touch authurl.info
echo "test" > authurl.info


echo_method_comment "Comment after sf authentication"

}

Output

$ test_script
install_salesforce_cli Installing Salesforce CLI...
11:18:10.845 | Installing sf...
install_salesforce_cli Successfully installed Salesforce CLI.
(node:428) Warning: Closing file descriptor 22 on garbage collection
(Use node --trace-warnings ... to show where the warning was created)
(node:428) [DEP0137] DeprecationWarning: Closing a FileHandle object on garbage collection is deprecated. Please close FileHandle objects explicitly using FileHandle.prototype.close(). In the future, an error will be thrown if a file descriptor is closed during garbage collection.
Successfully authorized [MASKED] with org ID 00D5Pxxxxxxxxxxx
11:18:35.704 | Comment after sf authentication
Saving cache for successful job
00:01
Creating cache main-2-protected...
WARNING: node_modules/: no matching files. Ensure that the artifact path is relative to the working directory (/builds/salesforce/caresnsw)
.sfdx/: found 2 matching artifact files and directories
Archive is up to date!
Created cache
Cleaning up project directory and file based variables
00:00
Job succeeded

@shabu74
Copy link
Author

shabu74 commented Nov 16, 2023

So, it is clear that the internal logic of sf org login command turned to be incompatible with node version I am using. Would you please tell me the version you have used for testing?

@mshanemc
Copy link
Contributor

We support latest and LTS, and that's what we test with. So that's currently 18, 20, 21
https://nodejs.org/en
https://nodejs.org/en/about/previous-releases

@shabu74
Copy link
Author

shabu74 commented Nov 16, 2023

@mshanemc Yes, understood. But I have issue only when calling sf login command. So, the problem is inside that command. right? I have issue only when I am calling that method. Changing version to satisfy this command will create problem in other areas. I have started using stable ver 19.9 to get rid of some file handling command issues.

@shabu74
Copy link
Author

shabu74 commented Nov 16, 2023

Now that warning has gone automatically :D

@shabu74 shabu74 closed this as completed Nov 16, 2023
@shabu74
Copy link
Author

shabu74 commented Nov 16, 2023

Got resolved automatically

@mshanemc
Copy link
Contributor

@shabu74 do you mind sharing what made it go away, in case others get it?

@shabu74 shabu74 reopened this Nov 17, 2023
@shabu74
Copy link
Author

shabu74 commented Nov 17, 2023

It has gone yesterday and came back again :( It is intermittent :(

@shabu74
Copy link
Author

shabu74 commented Nov 17, 2023

A
B
See the difference for authentications happened at n interval of 20 min. Earlier happened with warning. Later happened without warning.

@cristiand391
Copy link
Member

@shabu74 you can set this env var NODE_OPTIONS='--trace-deprecation' in your job to make node print where the deprecated is being emitted.

@shabu74
Copy link
Author

shabu74 commented Nov 21, 2023

I did it. It gave detailed trace for other warning. But no change for this. It displays the same. :(

@shabu74
Copy link
Author

shabu74 commented Nov 21, 2023

@cristiand391

@cristiand391
Copy link
Member

@shabu74 but did you get the original warning? You mentioned it's intermitent, with that env var, node will only print the stacktrace if the warning is emitted

Copy link

This issue has not received a response in 7 days. It will auto-close in 7 days unless a response is posted.

@github-actions github-actions bot added the stale label Nov 29, 2023
@shabu74
Copy link
Author

shabu74 commented Dec 1, 2023

@cristiand391 it did not make any difference.

I am still getting this warning.

@shabu74
Copy link
Author

shabu74 commented Dec 1, 2023

I have tried both --trace-deprecation and --trace-warning. --trace-deprecation did not make any change. --trace-warning did not give any trace for the issue. However, it gave the full trace for another warning.

image

@github-actions github-actions bot removed the stale label Dec 2, 2023
Copy link

github-actions bot commented Dec 9, 2023

This issue has not received a response in 7 days. It will auto-close in 7 days unless a response is posted.

@github-actions github-actions bot added the stale label Dec 9, 2023
@shabu74
Copy link
Author

shabu74 commented Dec 20, 2023

No one can explain it? It's a pain! :(

@cristiand391
Copy link
Member

cristiand391 commented Dec 22, 2023

@shabu74 going through node docs again, it seems there's --trace-deprecation and --trace-warnings:

https://nodejs.org/api/cli.html#--trace-deprecation
https://nodejs.org/api/cli.html#--trace-warnings

try setting NODE_OPTIONS='--trace-warnings' before calling sf to see if that works.

@cristiand391 cristiand391 removed the stale label Jan 3, 2024
@shabu74
Copy link
Author

shabu74 commented Jan 10, 2024

Tried all. No change observed. Getting the same message @cristiand391

Copy link

This issue has not received a response in 7 days. It will auto-close in 7 days unless a response is posted.

@mshanemc
Copy link
Contributor

closing, not reproducible on supported node versions.

@jdatskuid
Copy link

jdatskuid commented Mar 26, 2024

I am seeing this issue in my builds. I recently upgraded our docker image from node:18.13.0-alpine3.16 to node:18.19-alpine3.18.

This action also bumped our sf cli version from @salesforce/cli/2.3.8 linux-x64 node-v18.13.0 to @salesforce/cli/2.33.3 linux-x64 node-v18.19.1

The command that seems to be triggering the warning is:

echo node version: $(node --version)
echo sf cli version: $(sf --version)
sf org login jwt -i $JWT_CLIENT_ID -f jwt-temp/decoded.key -o $HUB_ORG_USERNAME -d -a HubOrg

The resulting logs are:

node version: v18.19.1
sf cli version: @salesforce/cli/2.33.3 linux-x64 node-v18.19.1
(node:148) Warning: Closing file descriptor 18 on garbage collection
(node:148) [DEP0137] DeprecationWarning: Closing a FileHandle object on garbage collection is deprecated. Please close FileHandle objects explicitly using FileHandle.prototype.close(). In the future, an error will be thrown if a file descriptor is closed during garbage collection.

(I've been wrestling with this for a couple days, so v18.19.1 was the latest release available when I started)

@mn-featurewave
Copy link

mn-featurewave commented Apr 20, 2024

I'm seeing this issue in Node 20 today (not using Node myself, but as part of sf cli), earlier it used to work fine, possibly due to update in sf cli.

mkdir ~/cli
mkdir ~/cli/sf
wget --no-verbose --continue https://developer.salesforce.com/media/salesforce-cli/sf/channels/stable/sf-linux-x64.tar.xz
tar --extract --xz --directory ~/cli/sf --file sf-linux-x64.tar.xz --strip-components 1
echo "$HOME/cli/sf/bin" >> $GITHUB_PATH

sf --version
echo *** > DEVHUB_SFDX_URL.txt
sf org login sfdx-url --json --sfdx-url-file DEVHUB_SFDX_URL.txt --alias devhub --set-default-dev-hub --set-default > SFDX_AUTH_JSON.json
rm -f DEVHUB_SFDX_URL.txt

@salesforce/cli/2.37.4 linux-x64 node-v20.11.1
(node:1603) Warning: Closing file descriptor 18 on garbage collection
(Use node --trace-warnings ... to show where the warning was created)
(node:1603) [DEP0137] DeprecationWarning: Closing a FileHandle object on garbage collection is deprecated. Please close FileHandle objects explicitly using FileHandle.prototype.close(). In the future, an error will be thrown if a file descriptor is closed during garbage collection.
Error: Process completed with exit code 1.

@shabu74
Copy link
Author

shabu74 commented Apr 20, 2024

Yea. But this guys closed this issue. Ridiculous! If they don’t have a solution, they will close it. That's the solution 😁😁

@shabu74
Copy link
Author

shabu74 commented Apr 20, 2024

Will closing this ticket solve the issue? @mshanemc

@mn-featurewave
Copy link

But this looks like just a warning, maybe it's failing for me due to authentication issue. But yeah, it will create issues in future once this is removed in future Node version, so needs a solution.

@mshanemc
Copy link
Contributor

Someone could open an issue that's reproducible on a supported node version @shabu74. Most comments on closed issues don't get monitored.

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 more information required Issue requires more information or a response from the customer validated Version information for this issue has been validated
Projects
None yet
Development

No branches or pull requests

6 participants