forcedotcom / cli

Salesforce CLI
https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/
BSD 3-Clause "New" or "Revised" License
493 stars 78 forks source link

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

Open mcarvin8 opened 2 days ago

mcarvin8 commented 2 days ago

Summary

This was previously reported in https://github.com/forcedotcom/cli/issues/2570 and closed due to version of NodeJS.

I'm recreating this issue as I've seen this warning upon multiple deployment pipelines with the latest Salesforce CLI and my node js version is node-v20.18.0. I've seen this warning with both CLI version 2.63.7 and 2.65.8. We recently made a major CLI upgrade (from 2.10.2 which didn't have this warning).

When running the echo {url} | sf org login sfdx-url --set-default --alias {alias} --sfdx-url-stdin command to authenticate to our org before starting a deployment in our CI/CD container, we consistently get this NodeJS warning.

I'm just running the echo {url} | sf org login sfdx-url --set-default --alias {alias} --sfdx-url-stdin command directly in the CI/CD shell which uses the environment variables defined at the job-level for authentication.

(node:37) Warning: Closing file descriptor 23 on garbage collection
(Use `node --trace-warnings ...` to show where the warning was created)
(node:37) [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.

{1D50E053-E446-4320-B2EB-456F14F802CF}

Authentication to the org is still successful and the deployment starts per normal, but I've consistently received this warning the 1st time I run the org login command in each new container. If I run a 2nd org login command in the same session, the warning doesn't appear, so it appears to be isolated to running the org login command the first time in a fresh container instance.

Steps To Reproduce

  1. Run echo {url} | sf org login sfdx-url --set-default --alias {alias} --sfdx-url-stdin command in a newly created Docker container
  2. Confirm authentication is successful.

Expected result

authentication is successful without any Node warnings

Actual result

authentication is successful with the Node warning consistently in multiple containers when running the command the 1st time.

Warning doesn't happen when running org login command multiple times in the same session.

System Information

Ubuntu latest Docker GitLab CI/CD

Here's our Dockerfile. Open to any suggestions but this is a pretty straight forward container and we need to publish custom container images to our work's container registry to avoid hitting a Docker Hub pull rate limit.

This Dockerfile is the same as we used with 2.10.2, except for the CLI version declared and the addition of the new SF_CI_HEARTBEAT_FREQUENCY_MS environment variable.

FROM ubuntu:latest

# Set Salesforce CLI Environment Variables
# https://developer.salesforce.com/docs/atlas.en-us.sfdx_setup.meta/sfdx_setup/sfdx_dev_cli_env_variables.htm
ENV SF_AUTOUPDATE_DISABLE=true \
    SF_USE_GENERIC_UNIX_KEYCHAIN=true \
    SF_DOMAIN_RETRY=300 \
    SF_PROJECT_AUTOUPDATE_DISABLE_FOR_PACKAGE_CREATE=true \
    SF_PROJECT_AUTOUPDATE_DISABLE_FOR_PACKAGE_VERSION_CREATE=true \
    SF_DISABLE_DNS_CHECK=true \
    SF_DISABLE_SOURCE_MEMBER_POLLING=true \
    SF_HIDE_RELEASE_NOTES=true \
    SF_HIDE_RELEASE_NOTES_FOOTER=true \
    SF_SKIP_NEW_VERSION_CHECK=true \
    SF_CONTAINER_MODE=true \
    SF_CI_HEARTBEAT_FREQUENCY_MS=60000

# Install Salesforce CLI and other required software (git, python3, jq, curl, nodejs)
# Print Salesforce CLI version in format accepted for Salesforce CLI bugs on GitHub
RUN apt-get update && apt-get install -y curl jq git python3 && \
    curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - && \
    apt-get install -y nodejs && \
    rm -rf /var/lib/apt/lists/* && \
    npm install --global @salesforce/cli@2.65.8 && \
    sf version --verbose --json
{
  "architecture": "linux-x64",
  "cliVersion": "@salesforce/cli/2.65.8",
  "nodeVersion": "node-v20.18.0",
  "osVersion": "Linux 6.1.87",
  "rootPath": "/usr/lib/node_modules/@salesforce/cli",
  "shell": "bash",
  "pluginVersions": [
    "@oclif/plugin-autocomplete 3.2.7 (core)",
    "@oclif/plugin-commands 4.1.5 (core)",
    "@oclif/plugin-help 6.2.16 (core)",
    "@oclif/plugin-not-found 3.2.24 (core)",
    "@oclif/plugin-plugins 5.4.15 (core)",
    "@oclif/plugin-search 1.2.13 (core)",
    "@oclif/plugin-update 4.6.8 (core)",
    "@oclif/plugin-version 2.2.15 (core)",
    "@oclif/plugin-warn-if-update-available 3.1.20 (core)",
    "@oclif/plugin-which 3.2.16 (core)",
    "@salesforce/cli 2.65.8 (core)",
    "apex 3.5.5 (core)",
    "api 1.3.1 (core)",
    "auth 3.6.70 (core)",
    "data 3.9.0 (core)",
    "deploy-retrieve 3.15.4 (core)",
    "info 3.4.15 (core)",
    "limits 3.3.37 (core)",
    "marketplace 1.3.2 (core)",
    "org 5.0.2 (core)",
    "packaging 2.8.12 (core)",
    "schema 3.3.39 (core)",
    "settings 2.4.2 (core)",
    "sobject 1.4.44 (core)",
    "telemetry 3.6.18 (core)",
    "templates 56.3.26 (core)",
    "trust 3.7.38 (core)",
    "user 3.6.0 (core)"
  ]
}
github-actions[bot] commented 2 days ago

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.