Skip to content

fix: prevent internal access of deprecated getters #1224

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

mcculloughrt-svh
Copy link

@mcculloughrt-svh mcculloughrt-svh commented Jun 27, 2025

The deprecated url and appUrl getters from uploadWithoutProgress were being accessed internally by the uploadFile utility, triggering deprecation console warnings even if the end user is not accessing those getters. This keeps the deprecation warnings by shifting them onto the object returned by uploadFile, while accessing them internally through getters marked "_internal" that do not trigger the warning.

See comment on issue from discord here

Summary by CodeRabbit

  • Bug Fixes

    • Resolved an issue where deprecation warnings appeared on every upload.
  • New Features

    • Added new non-deprecated properties for file URLs that avoid triggering warnings.
  • Style

    • Introduced deprecation warnings for certain file URL properties, guiding users to recommended alternatives.

Copy link

changeset-bot bot commented Jun 27, 2025

🦋 Changeset detected

Latest commit: e8ba10f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
uploadthing Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Jun 27, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
legacy-docs-uploadthing ⬜️ Ignored (Inspect) Visit Preview Jun 30, 2025 6:06pm

Copy link

vercel bot commented Jun 27, 2025

@mcculloughrt-svh is attempting to deploy a commit to the Ping Labs Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions bot added the sdk label Jun 27, 2025
Copy link
Contributor

coderabbitai bot commented Jun 27, 2025

## Walkthrough

This change refactors how deprecated properties `url` and `appUrl` are handled during file uploads. It introduces internal getters to avoid repeated deprecation warnings and updates the SDK to emit a warning only when these deprecated properties are accessed, advising users to use alternative properties.

## Changes

| File(s)                                                                                  | Change Summary                                                                                                                   |
|-----------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------|
| .changeset/tall-months-switch.md                                                        | Documents the patch addressing deprecation warnings for internal getter usage during uploads.                                     |
| packages/uploadthing/src/_internal/upload-server.ts                                     | Adds internal getter properties `_internalUrl` and `_internalAppUrl` to prevent triggering deprecation warnings internally.      |
| packages/uploadthing/src/sdk/utils.ts                                                   | Implements deprecation warnings on `url` and `appUrl` getters in the upload result, advising migration to `ufsUrl`.             |

## Sequence Diagram(s)

```mermaid
sequenceDiagram
    participant User
    participant SDK (uploadFile)
    participant Server (uploadWithoutProgress)

    User->>SDK (uploadFile): Call uploadFile()
    SDK (uploadFile)->>Server (uploadWithoutProgress): Initiate upload
    Server (uploadWithoutProgress)-->>SDK (uploadFile): Return response with _internalUrl, _internalAppUrl
    SDK (uploadFile)-->>User: Return file object with deprecated getters (url, appUrl)
    User->>SDK (uploadFile): Access file.url or file.appUrl
    SDK (uploadFile)-->>User: Emit deprecation warning, return internal URL

Possibly related PRs

Suggested reviewers

  • markflorkowski

<!-- walkthrough_end -->


---

<details>
<summary>📜 Recent review details</summary>

**Configuration used: CodeRabbit UI**
**Review profile: CHILL**
**Plan: Pro**


<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between 1028f76c6667e7318bcf0c82e5e4271826c516ee and e8ba10f4d33b798fc2ffcf79a81398cff9d54c16.

</details>

<details>
<summary>📒 Files selected for processing (1)</summary>

* `packages/uploadthing/src/_internal/upload-server.ts` (1 hunks)

</details>

<details>
<summary>🚧 Files skipped from review as they are similar to previous changes (1)</summary>

* packages/uploadthing/src/_internal/upload-server.ts

</details>

</details>
<!-- internal state start -->


<!-- DwQgtGAEAqAWCWBnSTIEMB26CuAXA9mAOYCmGJATmriQCaQDG+Ats2bgFyQAOFk+AIwBWJBrngA3EsgEBPRvlqU0AgfFwA6NPEgQAfACgjoCEYDEZyAAUASpETZWaCrKNxU3bABsvkCiQBHbGlcABpIcVwvOkgAIgAzeAAPLl4SKQxcFEzKDDRfNAY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AAE5wiXBKrmDWTpNRxpTIm+IiBaHAjUgKWgiiOhZGDvmne6Y94hiJQq7QCcTE3S7VHOeMc47qsTn41OgTsn8VyfQXOkSTbRJLhAiq+J+39IiLIYsGc7Q5LCeBNV9NT7xhTMsIxswrlNw3ncuMDyiBPL7ogV57z0RfNeM5fZ1oy7EydNbT8xQk6EIPjiiBmifUWMxd0hBIyakNA5Q0wyWQFXqB1ZOV2oa5yIItVgWYNqugaHaTCVpiHyOpqo/kLptD+E9UkIpXEPza5nNOudGqFikYNUIACparV0LsDWmgDaK8drwiYPtFQagjpjR4xNdK6gOyMLbP4Eqv86BtliqlE6Z1VMAEYAAMAAmAAHPEAA7AANgYPZ5ztmSC2YAMwmaswIBg8QzMMCsxZkgABWEgAAWCztmvMWcc8Fkz9mSADHGtVIU3m0DmfiGF2g7n3MCFs+WmzDALM+V8/ltAVmTPuYK75+I5baDBbCwweLRneNqdwBpxAWn0hlz+LQNstV9BAA== -->

<!-- internal state end -->
<!-- finishing_touch_checkbox_start -->

<details open="true">
<summary>✨ Finishing Touches</summary>

- [ ] <!-- {"checkboxId": "7962f53c-55bc-4827-bfbf-6a18da830691"} --> 📝 Generate Docstrings

</details>

<!-- finishing_touch_checkbox_end -->
<!-- tips_start -->

---

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

<details>
<summary>❤️ Share</summary>

- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)
- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)
- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)
- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)

</details>

<details>
<summary>🪧 Tips</summary>

### Chat

There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=pingdotgg/uploadthing&utm_content=1224):

- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
  - `I pushed a fix in commit <commit_id>, please review it.`
  - `Explain this complex logic.`
  - `Open a follow-up GitHub issue for this discussion.`
- Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:
  - `@coderabbitai explain this code block.`
  -	`@coderabbitai modularize this function.`
- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
  - `@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.`
  - `@coderabbitai read src/utils.ts and explain its main purpose.`
  - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`
  - `@coderabbitai help me debug CodeRabbit configuration file.`

### Support

Need help? Create a ticket on our [support page](https://www.coderabbit.ai/contact-us/support) for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

### CodeRabbit Commands (Invoked using PR comments)

- `@coderabbitai pause` to pause the reviews on a PR.
- `@coderabbitai resume` to resume the paused reviews.
- `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
- `@coderabbitai full review` to do a full review from scratch and review all the files again.
- `@coderabbitai summary` to regenerate the summary of the PR.
- `@coderabbitai generate docstrings` to [generate docstrings](https://docs.coderabbit.ai/finishing-touches/docstrings) for this PR.
- `@coderabbitai generate sequence diagram` to generate a sequence diagram of the changes in this PR.
- `@coderabbitai resolve` resolve all the CodeRabbit review comments.
- `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository.
- `@coderabbitai help` to get help.

### Other keywords and placeholders

- Add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.
- Add `@coderabbitai summary` to generate the high-level summary at a specific location in the PR description.
- Add `@coderabbitai` anywhere in the PR title to generate the title automatically.

### CodeRabbit Configuration File (`.coderabbit.yaml`)

- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.
- Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json`

### Documentation and Community

- Visit our [Documentation](https://docs.coderabbit.ai) for detailed information on how to use CodeRabbit.
- Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback.
- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.

</details>

<!-- tips_end -->

@mcculloughrt-svh mcculloughrt-svh changed the title Prevent internal access of deprecated getters fix: prevent internal access of deprecated getters Jun 27, 2025
Copy link
Member

@juliusmarminge juliusmarminge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Havne't had a chance to test it, but do we have the same issue server side?

@brrock
Copy link
Contributor

brrock commented Jun 27, 2025

Same issue with my self hosted version

@mcculloughrt-svh
Copy link
Author

mcculloughrt-svh commented Jun 30, 2025

Havne't had a chance to test it, but do we have the same issue server side?

Not sure, I don't think so... I looked for everywhere else the deprecation warning was used, and traced from there forward and the only other location I came up with where it might be called inadvertently is in the handleCallbackRequest of _internal/handler.ts, or something that utilizes its result. I don't think this issue exists there but I'm not familiar enough with Effect to know what's happening inside some of that to be honest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants