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

fix: nuxt module not passing options correctly #1018

Merged
merged 5 commits into from
Oct 16, 2024
Merged

Conversation

juliusmarminge
Copy link
Member

@juliusmarminge juliusmarminge commented Oct 16, 2024

Closes #1014

Summary by CodeRabbit

  • Bug Fixes

    • Resolved an issue with the upload handler by ensuring options are correctly forwarded.
  • New Features

    • Simplified configuration process for the upload settings by allowing all properties to be included without explicit listing.
  • Documentation

    • Updated TypeScript interface to reflect the removal of secret and appId properties.

Copy link

changeset-bot bot commented Oct 16, 2024

🦋 Changeset detected

Latest commit: 7bb47cc

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

This PR includes changesets to release 1 package
Name Type
@uploadthing/nuxt 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 Oct 16, 2024

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

Name Status Preview Comments Updated (UTC)
docs-uploadthing ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 16, 2024 8:13am
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
legacy-docs-uploadthing ⬜️ Skipped (Inspect) Oct 16, 2024 8:13am

Copy link
Contributor

coderabbitai bot commented Oct 16, 2024

Walkthrough

This pull request introduces a patch for the @uploadthing/nuxt package, ensuring that options are correctly forwarded to the upload handler. It modifies the ModuleOptions TypeScript interface by removing the secret and appId properties. Additionally, the handling of nuxt.options.runtimeConfig.uploadthing is updated to merge the entire options object instead of specific properties. These changes aim to simplify the configuration process while maintaining existing module setup functionalities.

Changes

File Path Change Summary
.changeset/sharp-needles-collect.md Introduced patch for @uploadthing/nuxt package; fixed options forwarding.
packages/nuxt/src/module.ts Updated ModuleOptions interface; removed secret and appId; changed options merging in setup function.

Assessment against linked issues

Objective Addressed Explanation
Fix invalid server configuration issue (#1014)

🐇 In the patch, options flow with glee,
No more bugs, just harmony!
With secrets and IDs now out of sight,
Configuration’s simpler, everything feels right!
So hop along, let’s upload with cheer,
A smoother process, let’s give a big cheer! 🎉


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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 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 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 for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

github-actions bot commented Oct 16, 2024

📦 Bundle size comparison

Bundle Size (gzip) Visualization
Main 26.11KB See Treemap 📊
PR (7b09564) 26.11KB See Treemap 📊
Diff No change

Copy link

pkg-pr-new bot commented Oct 16, 2024

@vercel vercel bot temporarily deployed to Preview – legacy-docs-uploadthing October 16, 2024 08:12 Inactive
@juliusmarminge juliusmarminge added the release canary Trigger a canary release to npm label Oct 16, 2024
Copy link
Contributor

A new canary is available for testing. You can install this latest build in your project with:

pnpm add @uploadthing/[email protected]
pnpm add @uploadthing/[email protected]
pnpm add @uploadthing/[email protected]
pnpm add @uploadthing/[email protected]
pnpm add @uploadthing/[email protected]
pnpm add @uploadthing/[email protected]
pnpm add @uploadthing/[email protected]
pnpm add [email protected]
pnpm add @uploadthing/[email protected]

@github-actions github-actions bot removed the release canary Trigger a canary release to npm label Oct 16, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (1)
.changeset/sharp-needles-collect.md (1)

1-5: LGTM! Consider enhancing the change description.

The changeset file is correctly formatted and appropriately describes the patch update for the "@uploadthing/nuxt" package. The use of a patch version bump is suitable for this bug fix.

To improve clarity, consider expanding the change description slightly. Here's a suggested revision:

- fix: options was not forwarded to uploadthing handler correctly
+ fix: ensure options are correctly forwarded to uploadthing handler in Nuxt module

This revision provides more context about the specific module affected by the fix.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 426b461 and 7bb47cc.

📒 Files selected for processing (2)
  • .changeset/sharp-needles-collect.md (1 hunks)
  • packages/nuxt/src/module.ts (1 hunks)
🧰 Additional context used
🔇 Additional comments (2)
packages/nuxt/src/module.ts (2)

Line range hint 1-91: Clarification needed on ModuleOptions interface changes

The AI-generated summary mentions the removal of secret and appId properties from the ModuleOptions interface. However, these changes are not visible in the provided code snippet. Could you please clarify:

  1. Were these properties removed from the ModuleOptions interface?
  2. If so, in which part of the file did this change occur?
  3. What was the rationale behind removing these properties?

This information is crucial for understanding the full scope of the changes and their potential impact on existing implementations.

To help clarify this, please run the following verification script:

#!/bin/bash
# Description: Check for the presence or absence of 'secret' and 'appId' in ModuleOptions

# Test: Search for 'secret' and 'appId' in ModuleOptions interface
echo "Checking ModuleOptions interface for 'secret' and 'appId':"
ast-grep --lang typescript --pattern 'export type ModuleOptions = RouteHandlerConfig & {
  $$$
  secret?: $_
  $$$
  appId?: $_
  $$$
}'

This script will help determine if these properties are still present in the ModuleOptions interface.


38-38: Approve change with considerations

The modification to merge the entire options object into nuxt.options.runtimeConfig.uploadthing aligns with the PR objective of fixing the issue with passing options correctly. This change simplifies the configuration process and allows for more flexible option passing.

However, please consider the following:

  1. Verify that all properties in options are safe to include in the runtime config, as this change could potentially expose sensitive information if not handled carefully.
  2. Update the documentation to reflect this change in behavior, clearly explaining which options are now available in the runtime config.
  3. Consider adding a migration guide for users upgrading from the previous version, especially if they relied on the specific handling of token and logLevel properties.

To ensure that this change doesn't introduce any unintended consequences, please run the following verification script:

This script will help identify any potential security concerns and verify the usage of the runtime config throughout the codebase.

✅ Verification successful

Verified: No sensitive information is exposed by merging options into nuxt.options.runtimeConfig.uploadthing.

The ModuleOptions interface does not include sensitive keys, and the usage of nuxt.options.runtimeConfig.uploadthing is appropriately scoped within module.ts. No further issues were found.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any sensitive information in the options object and verify usage of runtime config

# Test 1: Check for any sensitive keys in the ModuleOptions interface
echo "Checking ModuleOptions interface for potentially sensitive keys:"
ast-grep --lang typescript --pattern 'export type ModuleOptions = RouteHandlerConfig & {
  $$$
}'

# Test 2: Search for usage of nuxt.options.runtimeConfig.uploadthing in the codebase
echo "Checking usage of nuxt.options.runtimeConfig.uploadthing:"
rg --type typescript 'nuxt\.options\.runtimeConfig\.uploadthing'

# Test 3: Look for any comments or TODOs related to sensitive information in the config
echo "Checking for comments about sensitive information:"
rg --type typescript '(?i)(sensitive|secret|password|key).*config'

Length of output: 869


Script:

#!/bin/bash
# Description: Check for any sensitive information in the options object and verify usage of runtime config

# Test 1: Check for any sensitive keys in the ModuleOptions interface
echo "Checking ModuleOptions interface for potentially sensitive keys:"
ast-grep --lang typescript --pattern 'export type ModuleOptions = RouteHandlerConfig & {
  $$$
}'

# Test 2: Search for usage of nuxt.options.runtimeConfig.uploadthing in the codebase
echo "Checking usage of nuxt.options.runtimeConfig.uploadthing:"
rg 'nuxt\.options\.runtimeConfig\.uploadthing' --type-add 'typescript:*.ts,*.tsx' --type=typescript

# Test 3: Look for any comments or TODOs related to sensitive information in the config
echo "Checking for comments about sensitive information:"
rg '(?i)(sensitive|secret|password|key).*config' --type-add 'typescript:*.ts,*.tsx' --type=typescript

Length of output: 1147


Script:

#!/bin/bash
# Description: Check for any sensitive information in the options object and verify usage of runtime config

# Test 1: Check for any sensitive keys in the ModuleOptions interface
echo "Checking ModuleOptions interface for potentially sensitive keys:"
ast-grep --lang typescript --pattern 'export type ModuleOptions = RouteHandlerConfig & {
  $$$
}'

# Test 2: Search for usage of nuxt.options.runtimeConfig.uploadthing in the codebase
echo "Checking usage of nuxt.options.runtimeConfig.uploadthing:"
fd --extension ts --extension tsx --type f | xargs rg 'nuxt\.options\.runtimeConfig\.uploadthing'

# Test 3: Look for any comments or TODOs related to sensitive information in the config
echo "Checking for comments about sensitive information:"
fd --extension ts --extension tsx --type f | xargs rg '(?i)(sensitive|secret|password|key).*config'

Length of output: 1860

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

Successfully merging this pull request may close these issues.

[bug]: Nuxt: Invalid server configuration
1 participant