Skip to content

Asana - Create Project Bug Fix #16662

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

Merged
merged 5 commits into from
May 15, 2025
Merged

Asana - Create Project Bug Fix #16662

merged 5 commits into from
May 15, 2025

Conversation

michelle0927
Copy link
Collaborator

@michelle0927 michelle0927 commented May 14, 2025

Resolves #16651

Summary by CodeRabbit

  • New Features
    • Enhanced the project creation action with new options for team selection, privacy settings, and access level controls.
  • Bug Fixes
    • Corrected the API endpoint for fetching teams by workspace to improve reliability.
  • Chores
    • Updated version numbers for multiple Asana actions and sources to reflect recent changes and improvements.

Copy link

vercel bot commented May 14, 2025

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

3 Skipped Deployments
Name Status Preview Comments Updated (UTC)
docs-v2 ⬜️ Ignored (Inspect) Visit Preview May 15, 2025 2:38pm
pipedream-docs ⬜️ Ignored (Inspect) May 15, 2025 2:38pm
pipedream-docs-redirect-do-not-edit ⬜️ Ignored (Inspect) May 15, 2025 2:38pm

Copy link
Contributor

coderabbitai bot commented May 14, 2025

Walkthrough

This update primarily consists of version increments across multiple Asana component actions and sources. Additionally, the "Create Project" action receives substantial updates: prop renaming, additions, removals, description edits, and payload adjustments. The Asana app's getTeams method is also corrected to use the appropriate API endpoint for fetching teams by workspace.

Changes

File(s) Change Summary
components/asana/actions/add-task-to-section/add-task-to-section.mjs
components/asana/actions/create-subtask/create-subtask.mjs
components/asana/actions/create-task-comment/create-task-comment.mjs
components/asana/actions/create-task-from-template/create-task-from-template.mjs
components/asana/actions/create-task/create-task.mjs
components/asana/actions/delete-task/delete-task.mjs
components/asana/actions/find-task-by-id/find-task-by-id.mjs
components/asana/actions/get-tasks-from-task-list/get-tasks-from-task-list.mjs
components/asana/actions/search-projects/search-projects.mjs
components/asana/actions/search-sections/search-sections.mjs
components/asana/actions/search-tasks/search-tasks.mjs
components/asana/actions/search-user-projects/search-user-projects.mjs
components/asana/actions/update-task/update-task.mjs
Version number increment only; no functional or logic changes.
components/asana/actions/create-project/create-project.mjs Major prop updates: renaming, additions, removals, description edits, and payload update to match Asana API. Summary message improved.
components/asana/asana.app.mjs getTeams method updated to use correct API endpoint (workspaces/${workspace}/teams).
components/asana/package.json Package version incremented from 0.7.3 to 0.7.4.
components/asana/sources/new-completed-task/new-completed-task.mjs
components/asana/sources/new-project/new-project.mjs
components/asana/sources/new-story/new-story.mjs
components/asana/sources/new-subtask/new-subtask.mjs
components/asana/sources/new-tag/new-tag.mjs
components/asana/sources/new-task/new-task.mjs
components/asana/sources/new-team/new-team.mjs
components/asana/sources/new-user/new-user.mjs
components/asana/sources/new-workspace/new-workspace.mjs
components/asana/sources/tag-added-to-task/tag-added-to-task.mjs
components/asana/sources/tags-added-to-any-task/tags-added-to-any-task.mjs
components/asana/sources/task-assigned-in-project/task-assigned-in-project.mjs
components/asana/sources/task-field-updated-in-project/task-field-updated-in-project.mjs
components/asana/sources/task-updated-in-project/task-updated-in-project.mjs
Source version number increment only; no functional or logic changes.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant CreateProjectAction
    participant AsanaApp
    participant AsanaAPI

    User->>CreateProjectAction: Provide project creation parameters
    CreateProjectAction->>AsanaApp: Fetch teams for workspace (if organization)
    AsanaApp->>AsanaAPI: GET /workspaces/{workspace}/teams
    AsanaAPI-->>AsanaApp: Return teams list
    AsanaApp-->>CreateProjectAction: Return teams list
    CreateProjectAction->>AsanaAPI: POST /projects with updated payload (props, privacy, access levels)
    AsanaAPI-->>CreateProjectAction: Return created project info
    CreateProjectAction-->>User: Output created project GID and summary
Loading

Assessment against linked issues

Objective Addressed Explanation
Fix "Create Project" action to handle required team field, update deprecated public prop, and correct API usage (#16651)

Possibly related PRs

Suggested reviewers

  • jcortes

Poem

A bunny hopped through fields of code,
Updating versions as it strode.
With props renamed and bugs now gone,
The Asana project hops along!
Teams found in workspaces, not in dreams—
This rabbit’s code is clean, it seems.
🐇✨

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

components/asana/actions/create-project/create-project.mjs

Oops! Something went wrong! :(

ESLint: 8.57.1

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs
at packageResolve (node:internal/modules/esm/resolve:839:9)
at moduleResolve (node:internal/modules/esm/resolve:908:18)
at defaultResolve (node:internal/modules/esm/resolve:1038:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:557:12)
at ModuleLoader.resolve (node:internal/modules/esm/loader:525:25)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:246:38)
at ModuleJob._link (node:internal/modules/esm/module_job:126:49)

✨ Finishing Touches
  • 📝 Generate Docstrings

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.

❤️ 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.
    • 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 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 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 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.

@michelle0927 michelle0927 marked this pull request as ready for review May 14, 2025 18:30
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: 1

🔭 Outside diff range comments (1)
components/asana/actions/search-user-projects/search-user-projects.mjs (1)

42-51: ⚠️ Potential issue

Critical Issue: Asynchronous predicate used in Array.filter
The .filter(async (project) => { … }) callback returns a Promise<boolean> rather than a boolean, causing the filter to behave incorrectly (all entries are retained since Promises are truthy).

Proposed fix—await all membership checks and apply a synchronous filter:

-let { data: projects } = await this.asana.getProjects({
+let { data: projects } = await this.asana.getProjects({
   params: {
     workspace: this.workspace,
   },
   $,
 });
-
-projects = projects.filter(async (project) => {
-  const { data } = await this.asana.getProject({
-    projectId: project.gid,
-    $,
-  });
-
-  return data.members && !!_.find(data.members, {
-    gid: this.user,
-  });
-});
+// Check membership in parallel, then filter synchronously
+const checks = await Promise.all(projects.map(async (project) => {
+  const { data } = await this.asana.getProject({
+    projectId: project.gid,
+    $,
+  });
+  return !!(data.members && data.members.find((m) => m.gid === this.user));
+}));
+projects = projects.filter((_, idx) => checks[idx]);
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 0129ef7 and 7991b21.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (30)
  • components/asana/actions/add-task-to-section/add-task-to-section.mjs (1 hunks)
  • components/asana/actions/create-project/create-project.mjs (7 hunks)
  • components/asana/actions/create-subtask/create-subtask.mjs (1 hunks)
  • components/asana/actions/create-task-comment/create-task-comment.mjs (1 hunks)
  • components/asana/actions/create-task-from-template/create-task-from-template.mjs (1 hunks)
  • components/asana/actions/create-task/create-task.mjs (1 hunks)
  • components/asana/actions/delete-task/delete-task.mjs (1 hunks)
  • components/asana/actions/find-task-by-id/find-task-by-id.mjs (1 hunks)
  • components/asana/actions/get-tasks-from-task-list/get-tasks-from-task-list.mjs (1 hunks)
  • components/asana/actions/search-projects/search-projects.mjs (1 hunks)
  • components/asana/actions/search-sections/search-sections.mjs (1 hunks)
  • components/asana/actions/search-tasks/search-tasks.mjs (1 hunks)
  • components/asana/actions/search-user-projects/search-user-projects.mjs (1 hunks)
  • components/asana/actions/update-task/update-task.mjs (1 hunks)
  • components/asana/asana.app.mjs (1 hunks)
  • components/asana/package.json (1 hunks)
  • components/asana/sources/new-completed-task/new-completed-task.mjs (1 hunks)
  • components/asana/sources/new-project/new-project.mjs (1 hunks)
  • components/asana/sources/new-story/new-story.mjs (1 hunks)
  • components/asana/sources/new-subtask/new-subtask.mjs (1 hunks)
  • components/asana/sources/new-tag/new-tag.mjs (1 hunks)
  • components/asana/sources/new-task/new-task.mjs (1 hunks)
  • components/asana/sources/new-team/new-team.mjs (1 hunks)
  • components/asana/sources/new-user/new-user.mjs (1 hunks)
  • components/asana/sources/new-workspace/new-workspace.mjs (1 hunks)
  • components/asana/sources/tag-added-to-task/tag-added-to-task.mjs (1 hunks)
  • components/asana/sources/tags-added-to-any-task/tags-added-to-any-task.mjs (1 hunks)
  • components/asana/sources/task-assigned-in-project/task-assigned-in-project.mjs (1 hunks)
  • components/asana/sources/task-field-updated-in-project/task-field-updated-in-project.mjs (1 hunks)
  • components/asana/sources/task-updated-in-project/task-updated-in-project.mjs (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Verify TypeScript components
  • GitHub Check: Lint Code Base
  • GitHub Check: Publish TypeScript components
🔇 Additional comments (34)
components/asana/actions/create-task/create-task.mjs (1)

8-8: Approve version bump.
The action’s version has been correctly incremented from 0.4.2 to 0.4.3, matching the coordinated updates across Asana components. No further changes are needed here.

components/asana/actions/create-subtask/create-subtask.mjs (1)

8-8: Ensure version bump alignment and documentation updates.
The action version has been updated to "0.4.3", matching the coordinated minor bumps across other Asana components in this release. Please verify that the CHANGELOG, package manifest, and any release notes have been updated accordingly.

components/asana/actions/search-sections/search-sections.mjs (1)

7-7: Version updated to “0.2.10”
The patch bump here keeps this action in sync with the other Asana components in this release. No functional changes observed.

components/asana/sources/task-updated-in-project/task-updated-in-project.mjs (1)

10-10: Version bump for maintenance update

The version has been incremented from "1.1.8" to "1.1.9" as part of the larger bugfix update across Asana components.

components/asana/sources/new-tag/new-tag.mjs (1)

9-9: Version bump for maintenance update

The version has been incremented from "0.0.11" to "0.0.12" as part of the larger bugfix update across Asana components.

components/asana/package.json (1)

3-3: Package version update aligned with component fixes

The package version has been incremented from "0.7.3" to "0.7.4" to reflect the bug fix in the Asana app's getTeams method and version bumps across components.

components/asana/sources/new-project/new-project.mjs (1)

9-9: Version bump for maintenance update

The version has been incremented from "0.1.9" to "0.1.10" as part of the larger bugfix update across Asana components.

components/asana/actions/delete-task/delete-task.mjs (1)

8-8: Approve version bump
The patch-level version increment from "0.0.10""0.0.11" is consistent with other Asana action components and does not introduce functional changes.

components/asana/sources/task-field-updated-in-project/task-field-updated-in-project.mjs (1)

10-10: Approve version bump
Incrementing the version from "0.0.8""0.0.9" aligns with the coordinated patch release across Asana source components. No functional changes detected.

components/asana/sources/new-completed-task/new-completed-task.mjs (1)

10-10: Approve version bump
The version increment from "0.1.9""0.1.10" is consistent with related source components in this release. No other modifications.

components/asana/actions/create-task-from-template/create-task-from-template.mjs (1)

7-7: Approve version bump
The patch-level version bump from "0.0.4""0.0.5" is in line with other action components. No structural changes introduced.

components/asana/sources/tags-added-to-any-task/tags-added-to-any-task.mjs (1)

10-10: Version bump to 0.0.9 is correct.
This aligns with the coordinated version increments across Asana source components in this PR, with no functional changes introduced here.

components/asana/sources/new-team/new-team.mjs (1)

9-9: Version bump to 0.1.11 is correct.
No other changes in this file; version increment matches the pattern across Asana sources.

components/asana/sources/new-workspace/new-workspace.mjs (1)

9-9: Version bump to 0.1.11 is correct.
No functional changes beyond the version update, consistent with the rest of the Asana integration.

components/asana/sources/tag-added-to-task/tag-added-to-task.mjs (1)

10-10: Version bump to 0.1.10 is correct.
This update is purely metadata-only, matching the coordinated versioning in this PR.

components/asana/sources/new-user/new-user.mjs (1)

9-9: Version bump to 0.1.10 is correct.
No other modifications; this aligns with the global version increments for Asana sources.

components/asana/actions/get-tasks-from-task-list/get-tasks-from-task-list.mjs (1)

7-7: Bump version to 0.0.8
Version increment only—no functional changes.

components/asana/actions/find-task-by-id/find-task-by-id.mjs (1)

8-8: Bump version to 0.2.10
Patch version updated without logic changes.

components/asana/actions/create-task-comment/create-task-comment.mjs (1)

8-8: Bump version to 0.2.10
Only the version string was updated.

components/asana/sources/new-task/new-task.mjs (1)

10-10: Bump version to 0.1.10
Version increment aligns with coordinated package release.

components/asana/actions/search-tasks/search-tasks.mjs (1)

9-9: Bump version to 0.3.4
No other changes besides the patch version update.

components/asana/sources/new-subtask/new-subtask.mjs (1)

10-10: Consistent version bump for New Subtask source.

The component version has been correctly updated from 1.0.9 to 1.0.10. No functional or structural changes detected.

components/asana/actions/search-projects/search-projects.mjs (1)

6-6: Consistent version bump for Search Projects action.

The component version has been correctly updated from 0.2.9 to 0.2.10. This aligns with the coordinated minor release across Asana actions.

components/asana/sources/task-assigned-in-project/task-assigned-in-project.mjs (1)

10-10: Consistent version bump for Task Assigned In Project source.

The component version has been correctly updated from 0.1.2 to 0.1.3. No logic changes introduced.

components/asana/sources/new-story/new-story.mjs (1)

10-10: Consistent version bump for New Story source.

The component version has been correctly updated from 0.1.9 to 0.1.10. Functionality remains unchanged.

components/asana/actions/update-task/update-task.mjs (1)

8-8: Consistent version bump for Update Task action.

The component version has been correctly updated from 0.4.2 to 0.4.3. No modifications to props or behavior were made.

components/asana/actions/add-task-to-section/add-task-to-section.mjs (1)

8-8: Version increment looks good

The version has been properly incremented from 0.2.9 to 0.2.10, which aligns with the version updates across other Asana action components in this PR.

components/asana/actions/create-project/create-project.mjs (7)

8-8: Version increment looks good

The version has been properly incremented from 0.10.2 to 0.10.3, reflecting the significant changes made to this component.


31-45: Team property implementation looks good

The team property has been properly implemented to dynamically filter teams based on the selected workspace. This improvement supports the bug fix by correctly fetching teams from the workspace.


72-82: Privacy setting property enhancement

The boolean public property has been replaced with a more descriptive privacySetting string property that offers three explicit options. This provides better clarity and more granular control over project visibility.


59-60: Props renamed to follow camelCase convention

Props have been consistently renamed from snake_case to camelCase (defaultView, dueOn, startOn, htmlNotes), improving code consistency.

Also applies to: 90-91, 96-97, 115-116


134-165: New access level properties added

Three new optional properties related to access levels have been added:

  1. defaultAccessLevel - Controls default access for new members
  2. minimumAccessLevelForCustomization - Controls who can modify the project's workflow
  3. minimumAccessLevelForSharing - Controls who can share the project

These additions provide more fine-grained control over project permissions.


175-190: Request payload updated to match property changes

The request payload in the run method has been correctly updated to reflect all property renames and additions:

  • Using team instead of previous property
  • Using camelCase in the UI but snake_case in the API request payload
  • Added new access level properties

This change ensures the API receives properly formatted data.


195-195: Improved success message

The success message now includes the created project's GID, which provides more useful feedback to the user.

GTFalcao
GTFalcao previously approved these changes May 14, 2025
Copy link
Collaborator

@GTFalcao GTFalcao left a comment

Choose a reason for hiding this comment

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

LGTM!

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

🧹 Nitpick comments (2)
components/asana/actions/create-project/create-project.mjs (2)

47-47: Incorrect description for color prop

The description refers to "the color associated with the status update" when it should reference the project color instead.

-      description: "The color associated with the status update",
+      description: "The color associated with the project",

21-34: Consider validation for team requirement

The description states: "If the workspace for your project is an organization, you must supply a team to share the project with." Consider adding validation to enforce this requirement when applicable.

You could add validation in the run method to check if the workspace is an organization and if so, verify that a team is provided:

async run({ $ }) {
  // Check if workspace is an organization and team is required
  if (!this.team) {
    const workspace = await this.asana.getWorkspace(this.workspace);
    if (workspace.is_organization) {
      throw new Error("Team is required when workspace is an organization");
    }
  }
  
  // Rest of the existing code...
}

Alternatively, you could make the team prop conditionally required based on the workspace type.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between 82c1825 and dd1e7e3.

📒 Files selected for processing (1)
  • components/asana/actions/create-project/create-project.mjs (7 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: pnpm publish
  • GitHub Check: Publish TypeScript components
  • GitHub Check: Verify TypeScript components
  • GitHub Check: Lint Code Base
🔇 Additional comments (8)
components/asana/actions/create-project/create-project.mjs (8)

8-8: Version bump looks good

The version bump from 0.10.2 to 0.10.3 is appropriate for the bug fixes and enhancements being made.


21-34: Good addition of the team prop with dynamic filtering

The new team prop with dynamic filtering based on the selected workspace is a valuable addition. This correctly leverages the updated getTeams method that now fetches teams from the proper API endpoint.


58-61: Good rename from snake_case to camelCase

Renaming default_view to defaultView improves consistency with JavaScript conventions while the API mapping in the run method correctly translates it back to snake_case for the Asana API.


71-80: Improved privacy control with explicit options

Replacing the boolean public prop with a more descriptive privacySetting string provides users with clearer options and better maps to Asana's API capabilities.


89-90: Consistent prop naming to camelCase

The renaming of props from snake_case to camelCase (due_ondueOn, start_onstartOn, html_noteshtmlNotes) improves code consistency while maintaining proper API mapping.

Also applies to: 95-96, 114-115


133-164: Good addition of access level controls

Adding these three new access level props (defaultAccessLevel, minimumAccessLevelForCustomization, minimumAccessLevelForSharing) provides users with more fine-grained control over project permissions.


174-189: Correctly mapped camelCase props to snake_case API fields

The request payload correctly maps the camelCase component props to the snake_case fields expected by the Asana API, ensuring compatibility.


194-194: Improved summary message with project GID

Including the project GID in the summary export message provides users with a direct reference to the newly created project, improving usability.

@michelle0927
Copy link
Collaborator Author

/approve

@michelle0927 michelle0927 merged commit 5dc69d1 into master May 15, 2025
11 checks passed
@michelle0927 michelle0927 deleted the issue-16651 branch May 15, 2025 19:37
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] Asana Create Project action is broken
2 participants