Skip to content

Silence deprecation warnings without NODE_OPTIONS - #80

Merged
tibo-openai merged 1 commit into
openai:mainfrom
jonchurch:silence-deprecation
Apr 16, 2025
Merged

tibo-openai merged 1 commit into
openai:mainfrom
jonchurch:silence-deprecation

Conversation

@jonchurch

@jonchurch jonchurch commented Apr 16, 2025 •

Copy link
Copy Markdown
Contributor

TIL this even works, wow, it feels like a hack though for sure.

Can override process.noDeprecations to silence warnings. This use isnt even documented, but works in local testing

This can serve as an unblock until a better fix is landed

Specifically it was punycode in node 22 that is being used in the transitive dep tree, and giving deprecation warnings.

Closes #42

@jonchurch

This comment was marked as outdated.

@jonchurch

Copy link
Copy Markdown
Contributor Author

This works, but to get it to work in this codebase we'd need to fight the linter and ts. Idk why it is absent from the Node types.

Crimes we'd need to commit:

  1. Using this hack instead of NODE_OPTIONS, means it must be set before any deprecations have a chace to be emitted
  2. Casting to any (process as any).noDeprecation = true
  3. Tell eslint to ignore the explicit any

@tibo-openai

Copy link
Copy Markdown
Collaborator

Fine with the proposed crimes 1/2/3. We can come back and clean this up once folks are unblocked.

@fouad

fouad commented Apr 16, 2025 •

Copy link
Copy Markdown

yeah I'm thinking we just remove the NODE_OPTIONS (later clean up transitive deps) but down to just make it work for people - thanks Jon!

@jonchurch

Copy link
Copy Markdown
Contributor Author

@tibo-openai, I think a better options is what I've just pushed

Just pass the cli flag, simple enough. I don't think this breaks anyone

NODE_OPTIONS is a useful convention for multiple flags, but if we can get away with just a flag then lets ship it

@jonchurch
jonchurch force-pushed the silence-deprecation branch from d692a71 to 5bd5013 Compare April 16, 2025 19:54
@jonchurch

jonchurch commented Apr 16, 2025 •

Copy link
Copy Markdown
Contributor Author

Im thrashing in this PR rn, excuse the sloppy work.

NODE_OPTIONS is designed to help with this specific issue, where /usr/bin/env will only accept one argument, the binary to execute. Im not confident that it works on all systems, it works on mine though and my version of env

So still searching for the correct portable way to do this

@jonchurch
jonchurch marked this pull request as draft April 16, 2025 19:58
@jonchurch

jonchurch commented Apr 16, 2025 •

Copy link
Copy Markdown
Contributor Author

Here's what I'll do, I'll restore the hacky approach that works
process.noDeprecations and that can be accepted if yall want to unblock fast

A better fix can land later
edit: restored it back to original hacky fix

@jonchurch
jonchurch force-pushed the silence-deprecation branch from 5bd5013 to e1d41e5 Compare April 16, 2025 20:05
@jonchurch
jonchurch marked this pull request as ready for review April 16, 2025 20:06
@jonchurch
jonchurch force-pushed the silence-deprecation branch from e1d41e5 to e81d461 Compare April 16, 2025 20:09
@tibo-openai

Copy link
Copy Markdown
Collaborator

ty!!

@jonchurch

Copy link
Copy Markdown
Contributor Author

For context, after #96 users wont have a failure on startup.

So this PR is only needed now to silence any deprecations they may see in the console

@tibo-openai

Copy link
Copy Markdown
Collaborator

Seeing

Error: ❌  DCO check failed.

Commits missing the 'Signed-off-by:' footer:
f070dba

🛠 **Quick fix (make ONE signed commit):**
    git fetch origin
    git reset --soft origin/main
    git commit -s -m "<your message>"
    git push --force-with-lease

🔧 **Fix individual commits:**
    git rebase -i origin/main --exec "git commit --amend -s --no-edit"
    git push --force-with-lease

💡  Or edit the commit message in GitHub UI and add:
    Signed-off-by: Your Name <[email protected]>
Error: Process completed with exit code 1.

see https://github.com/openai/codex?tab=readme-ov-file#developer-certificate-of-origin-dco.

Could you resolve?

@jonchurch

jonchurch commented Apr 16, 2025 •

Copy link
Copy Markdown
Contributor Author

Yeah, I'll rebase. The merge commit that I assume you did via github UI wiped out the signoff I had.

I guess your DCO check requires all commits signed? Merge commits are commits too, so will run afoul of this unless signed

@jonchurch
jonchurch force-pushed the silence-deprecation branch from 20ecc08 to 8ca9877 Compare April 16, 2025 21:19
@runofthemillgeek

Copy link
Copy Markdown

This shebang line would also work btw, less messy to deal with. NODE_OPTIONS afaik is meant to provide an environment variable approach to pass CLI options to node.

Tested the following script.js locally and seems to work (node v22.14.0).

#!/usr/bin/env -S node --no-deprecation
console.log("works")

@jonchurch

Copy link
Copy Markdown
Contributor Author

@runofthemillgeek The crux of the issue is that -S is apparently not portable everywhere. Not all versions of distributed env support that flag. It works on my machine too, but apparently not all ¯\(ツ)/¯

Which is the original issue in #42

@runofthemillgeek

Copy link
Copy Markdown

@runofthemillgeek The crux of the issue is that -S is apparently not portable everywhere. Not all versions of distributed env support that flag. It works on my machine too, but apparently not all ¯_(ツ)_/¯

Which is the original issue in #42

Saw that but as #42 (comment) said, that's not the case at all. I just think passing it at front like that is prolly causing issues on some OS versions (works fine on my macOS 15.4 too). env -S is def a thing on macOS. env on macOS has other weird quirks but this is not one of them.

Anyway, just thought to share that.

@tibo-openai
tibo-openai merged commit 05c458b into openai:main Apr 16, 2025
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 16, 2025
@jonchurch
jonchurch deleted the silence-deprecation branch April 16, 2025 22:37
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

codex fails to launch on macOS due to unsupported env -S shebang

4 participants