Skip to content

[BUG] Microsoft Calendar using Get Busy/Free action throwing error #17911

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 1 commit into from
Aug 4, 2025

Conversation

jcortes
Copy link
Collaborator

@jcortes jcortes commented Aug 1, 2025

WHY

Resolves #17492

Summary by CodeRabbit

  • New Features

    • Improved input handling for schedules by supporting multiple input formats.
    • Added validation to ensure schedules are provided before proceeding.
  • Enhancements

    • Updated the label for the schedules input from "Emails" to "Schedules" for clarity.
  • Chores

    • Updated component and package versions.

@jcortes jcortes self-assigned this Aug 1, 2025
Copy link

vercel bot commented Aug 1, 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) Aug 1, 2025 9:58pm
pipedream-docs ⬜️ Ignored (Inspect) Aug 1, 2025 9:58pm
pipedream-docs-redirect-do-not-edit ⬜️ Ignored (Inspect) Aug 1, 2025 9:58pm

Copy link
Contributor

coderabbitai bot commented Aug 1, 2025

Walkthrough

The changes introduce a utility for parsing input arrays, update the "Get Schedule" action to use this utility and validate its input, and increment version numbers in both the action and package files. The action now throws a configuration error for invalid or empty input and uses the parsed array in its API request.

Changes

Cohort / File(s) Change Summary
Get Schedule Action Update
components/microsoft_outlook_calendar/actions/get-schedule/get-schedule.mjs
- Import ConfigurationError and new utils module
- Change property label from "Emails" to "Schedules"
- Add input validation for schedules property
- Use utils.parseArray to parse input
- Update API call and summary message
- Bump action version to 0.0.3
New Utility Module
components/microsoft_outlook_calendar/common/utils.mjs
- Add new utility with parseArray method to normalize various input types into an array of strings
Package Version Bump
components/microsoft_outlook_calendar/package.json
- Increment package version from 0.3.1 to 0.3.2

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant GetScheduleAction
    participant Utils
    participant MicrosoftGraphAPI

    User->>GetScheduleAction: Provide schedules input
    GetScheduleAction->>Utils: parseArray(schedules)
    Utils-->>GetScheduleAction: Parsed schedules array
    GetScheduleAction->>GetScheduleAction: Validate parsed schedules
    alt Invalid or empty
        GetScheduleAction-->>User: Throw ConfigurationError
    else Valid
        GetScheduleAction->>MicrosoftGraphAPI: POST /me/calendar/getSchedule (parsed schedules)
        MicrosoftGraphAPI-->>GetScheduleAction: Response
        GetScheduleAction-->>User: Return result
    end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Assessment against linked issues

Objective Addressed Explanation
Fix error when "Get Busy/Free" action is used with null/empty emails parameter (#17492)
Update input validation and parsing for the "Get Schedule" action to match API expectations (#17492)
Change property label from "Emails" to "Schedules" for clarity in the action (#17492)

Assessment against linked issues: Out-of-scope changes

No out-of-scope changes found.

Poem

A calendar hop, a schedule to see,
With arrays parsed smartly, as easy as can be.
No more errors for empty or null,
The rabbit now finds your free time in full!
Version numbers rising, code neat and bright—
Meetings or magic, your schedule’s just right.
🐇✨

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 5a3f4e5 and 0336a73.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (3)
  • components/microsoft_outlook_calendar/actions/get-schedule/get-schedule.mjs (3 hunks)
  • components/microsoft_outlook_calendar/common/utils.mjs (1 hunks)
  • components/microsoft_outlook_calendar/package.json (1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: when exporting a summary message in the `run` method of an action, ensure the message is correctly f...
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#12731
File: components/hackerone/actions/get-members/get-members.mjs:3-28
Timestamp: 2024-07-04T18:11:59.822Z
Learning: When exporting a summary message in the `run` method of an action, ensure the message is correctly formatted. For example, in the `hackerone-get-members` action, the correct format is `Successfully retrieved ${response.data.length} members`.

Applied to files:

  • components/microsoft_outlook_calendar/actions/get-schedule/get-schedule.mjs
📚 Learning: in overledger actions, `inputparameters` and `outputparameters` are defined as `string[]`, and are p...
Learnt from: philbuuza
PR: PipedreamHQ/pipedream#14228
File: components/overledger/actions/read-from-a-smart-contract/read-from-smart-contract.mjs:27-32
Timestamp: 2024-10-08T16:26:11.372Z
Learning: In Overledger actions, `inputParameters` and `outputParameters` are defined as `string[]`, and are parsed within the code to create the required objects for the request.

Applied to files:

  • components/microsoft_outlook_calendar/common/utils.mjs
📚 Learning: in overledger actions, the `inputparameters` property is an array of objects and should be passed di...
Learnt from: lukerQuant
PR: PipedreamHQ/pipedream#14217
File: components/overledger/actions/read-from-a-smart-contract/read-from-smart-contract.mjs:62-62
Timestamp: 2024-10-07T08:28:35.205Z
Learning: In Overledger actions, the `inputParameters` property is an array of objects and should be passed directly without parsing.

Applied to files:

  • components/microsoft_outlook_calendar/common/utils.mjs
🔇 Additional comments (9)
components/microsoft_outlook_calendar/common/utils.mjs (2)

1-38: LGTM! Robust utility function with good error handling.

The parseArray function effectively handles various input types and normalizes them to string arrays, which aligns perfectly with the Microsoft Graph API requirements. The JSON parsing with fallback and type coercion logic is well-implemented.


3-5: Consider the interaction with validation logic.

The function returns an empty array for falsy inputs, but the validation in get-schedule.mjs throws a ConfigurationError for empty arrays. This creates a consistent flow where falsy inputs are normalized to empty arrays, which then trigger the validation error - this is the correct behavior for the API requirement.

components/microsoft_outlook_calendar/package.json (1)

3-3: LGTM! Appropriate version bump for bug fix.

The version increment from 0.3.1 to 0.3.2 correctly follows semantic versioning for a bug fix that doesn't introduce breaking changes.

components/microsoft_outlook_calendar/actions/get-schedule/get-schedule.mjs (6)

1-3: LGTM! Proper imports for the bug fix.

The addition of ConfigurationError for input validation and the utils module for array parsing are appropriate dependencies for resolving the Microsoft Graph API parameter formatting issue.


9-9: LGTM! Appropriate version increment.

The version bump from 0.0.2 to 0.0.3 correctly reflects the bug fix changes.


15-15: LGTM! Label aligns with API parameter.

Changing the label from "Emails" to "Schedules" better reflects the actual API parameter name and improves clarity.


53-57: Robust input validation addresses the core bug.

The validation logic correctly handles the cases that were causing the Microsoft Graph API error:

  • Null/undefined inputs that would cause API failures
  • Empty arrays that don't provide meaningful schedule data
  • The utils.parseArray call ensures proper formatting of the schedules parameter

This directly resolves the issue described in #17492 where the API was receiving improperly formatted email collections.


62-62: API call now uses properly formatted schedules parameter.

Using the parsed schedules array instead of the raw input ensures the Microsoft Graph API receives a properly formatted non-null collection, which was the root cause of the reported error.


75-75: Summary message accurately reflects processed data.

The summary now uses the parsed schedules array, providing accurate feedback about what was actually sent to the API.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-ms-calendar-get-schedule

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 generate unit tests to generate unit tests for 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.

Copy link
Collaborator

@michelle0927 michelle0927 left a comment

Choose a reason for hiding this comment

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

LGTM! Moving to QA

One comment/question: I wonder if the schedules prop could be improved to use async options by using this endpoint: https://learn.microsoft.com/en-us/graph/api/user-list

@jcortes
Copy link
Collaborator Author

jcortes commented Aug 2, 2025

LGTM! Moving to QA

One comment/question: I wonder if the schedules prop could be improved to use async options by using this endpoint: https://learn.microsoft.com/en-us/graph/api/user-list

Hi @michelle0927 actually I was testing this endpoint and seems like is not working on Microsoft side. Here it is a test I made from the graphql explorer itself

image

This is the grapql explorer tool https://developer.microsoft.com/en-us/graph/graph-explorer

I've also tested with curl

curl https://graph.microsoft.com/v1.0/users\?$select\=id,displayName,mail \
-H "Authorization: Bearer $API_KEY"

The error was:

{"@odata.context":"https://graph.microsoft.com/v1.0/$metadata#users","value":[{"error":{"code":"InternalServerError","message":"Invalid response. Expected list response must have value property.","innerError":{"date":"2025-08-02T20:09:00","request-id":"4cf8738b-9645-4f6f-afe7-2d96d5d845e1","client-request-id":"4cf8738b-9645-4f6f-afe7-2d96d5d845e1"}}}

@jcortes jcortes merged commit b0e413e into master Aug 4, 2025
11 checks passed
@jcortes jcortes deleted the fix-ms-calendar-get-schedule branch August 4, 2025 14:46
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] Microsoft Calendar using "Get Busy/Free" action throwing error
2 participants