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

[rush] ERROR: unacceptable kind of an object to dump (undefined) #5053

Open
octogonz opened this issue Dec 18, 2024 · 3 comments · May be fixed by #5056
Open

[rush] ERROR: unacceptable kind of an object to dump (undefined) #5053

octogonz opened this issue Dec 18, 2024 · 3 comments · May be fixed by #5056
Labels
bug Something isn't working as intended priority The maintainers consider it to be an important issue. We should try to fix it soon.

Comments

@octogonz
Copy link
Collaborator

Summary

In this Zulip thread, Ethan reports an error that appears to be a regression introduced by Rush 5.146.0:

ERROR: unacceptable kind of an object to dump [object Undefined]

This is the YAML serializer telling us that it encountered an undefined value in one of the objects to be serialized (which is not supported by strict serializers).

I'm guessing it might be this change in PnpmShrinkWrapFileConverters.ts.

Repro steps

(We haven't isolated a repro yet. I was unable to repro in the Rush Stach repository.)

Expected result:

Actual result:

Details

rush --debug update prints:

Running "pnpm install" in /home/devuser/git/align-ts/common/temp


Invoking package manager: /home/devuser/.rush/node-v20.18.0/pnpm-9.13.2/node_modules/pnpm/bin/pnpm.cjs install --store /home/devuser/git/align-ts/common/temp/pnpm-store --config.cacheDir=/home/devuser/git/align-ts/common/temp/pnpm-store --config.stateDir=/home/devuser/git/align-ts/common/temp/pnpm-store --no-prefer-frozen-lockfile --strict-peer-dependencies --config.auto-install-peers=false --config.resolutionMode=highest --config.ignoreCompatibilityDb --recursive --link-workspace-packages false --reporter default

Scope: all 101 workspace projects
../../apps/admin-api-example             |  WARN  deprecated [email protected]
...onflict-resolution-components-example |  WARN  deprecated @babel/[email protected]
 WARN  21 deprecated subdependencies found: @babel/[email protected], @babel/[email protected], @babel/[email protected], @babel/[email protected], @babel/[email protected], @humanwhocodes/[email protected], @humanwhocodes/[email protected], @types/[email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
.                                        |    +2117 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Progress: resolved 2098, reused 2015, downloaded 0, added 2117, done
Done in 8.7s


ERROR: unacceptable kind of an object to dump [object Undefined]

YAMLException: unacceptable kind of an object to dump [object Undefined]
    at writeNode (/home/devuser/.nvm/versions/node/v20.18.0/lib/node_modules/@microsoft/rush/node_modules/js-yaml/lib/js-yaml/dumper.js:756:13)
    at writeBlockMapping (/home/devuser/.nvm/versions/node/v20.18.0/lib/node_modules/@microsoft/rush/node_modules/js-yaml/lib/js-yaml/dumper.js:634:10)
    at writeNode (/home/devuser/.nvm/versions/node/v20.18.0/lib/node_modules/@microsoft/rush/node_modules/js-yaml/lib/js-yaml/dumper.js:727:9)
    at writeBlockMapping (/home/devuser/.nvm/versions/node/v20.18.0/lib/node_modules/@microsoft/rush/node_modules/js-yaml/lib/js-yaml/dumper.js:634:10)
    at writeNode (/home/devuser/.nvm/versions/node/v20.18.0/lib/node_modules/@microsoft/rush/node_modules/js-yaml/lib/js-yaml/dumper.js:727:9)
    at writeBlockMapping (/home/devuser/.nvm/versions/node/v20.18.0/lib/node_modules/@microsoft/rush/node_modules/js-yaml/lib/js-yaml/dumper.js:634:10)
    at writeNode (/home/devuser/.nvm/versions/node/v20.18.0/lib/node_modules/@microsoft/rush/node_modules/js-yaml/lib/js-yaml/dumper.js:727:9)
    at dump (/home/devuser/.nvm/versions/node/v20.18.0/lib/node_modules/@microsoft/rush/node_modules/js-yaml/lib/js-yaml/dumper.js:817:7)
    at Proxy.safeDump (/home/devuser/.nvm/versions/node/v20.18.0/lib/node_modules/@microsoft/rush/node_modules/js-yaml/lib/js-yaml/dumper.js:823:10)
    at PnpmShrinkwrapFile._serializeInternal (/home/devuser/.nvm/versions/node/v20.18.0/lib/node_modules/@microsoft/rush/node_modules/@microsoft/rush-lib/dist/commons.js:23494:27)

Standard questions

Please answer these questions to help us investigate your issue more quickly:

Question Answer
rushVersion from rush.json? 5.147.0
Node.js version (node -v)? 20.15.0
@github-project-automation github-project-automation bot moved this to Needs triage in Bug Triage Dec 18, 2024
@octogonz octogonz added bug Something isn't working as intended priority The maintainers consider it to be an important issue. We should try to fix it soon. labels Dec 18, 2024
@octogonz
Copy link
Collaborator Author

Likely a regression from [rush-lib] Support pnpm lockfile v9 #5009

@fzxen

@fzxen
Copy link
Contributor

fzxen commented Dec 23, 2024

@octogonz you are right. The following code caused this issue.

const dependencies: ResolvedDependencies | undefined =
from.dependencies == null ? from.dependencies : moveSpecifiers(from.dependencies);
const devDependencies: ResolvedDependencies | undefined =
from.devDependencies == null ? from.devDependencies : moveSpecifiers(from.devDependencies);
const optionalDependencies: ResolvedDependencies | undefined =
from.optionalDependencies == null ? from.optionalDependencies : moveSpecifiers(from.optionalDependencies);
return {
...from,
specifiers,
dependencies,
devDependencies,
optionalDependencies
};

After I set the preventManualShrinkwrapChanges field in the pnpm-config.json file to true, I successfully reproduced this problem.

I will submit a PR to fix the issue later.

@octogonz
Copy link
Collaborator Author

Thank you! 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working as intended priority The maintainers consider it to be an important issue. We should try to fix it soon.
Projects
Status: Needs triage
2 participants