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

bug report: SpecParser.generate-failed #13337

Open
2BitSalute opened this issue Mar 5, 2025 · 4 comments
Open

bug report: SpecParser.generate-failed #13337

2BitSalute opened this issue Mar 5, 2025 · 4 comments
Assignees
Labels
investigating needs more info Need user to provide more info TA:Auth Team Area: Auth

Comments

@2BitSalute
Copy link

TypeError: Cannot read properties of undefined (reading 'schema')

stack:
generate-failed: TypeError: Cannot read properties of undefined (reading 'schema')
at SCr (<REDACTED: user-file-path>/extension.js:486:25525)
at Axo (<REDACTED: user-file-path>/extension.js:486:19139)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async O5r.post (<REDACTED: user-file-path>/extension.js:735:3220)
at async O5r.run (<REDACTED: user-file-path>/extension.js:610:66960)
at async O5r. (<REDACTED: user-file-path>/extension.js:610:39499)
at async zne.create (<REDACTED: user-file-path>/extension.js:803:7641)
at async zne. (<REDACTED: user-file-path>/extension.js:610:39499)
at async zne. (<REDACTED: user-file-path>/extension.js:14:389828)
at async Lf.createProject (<REDACTED: user-file-path>/extension.js:902:16292)
at async Lf. (<REDACTED: user-file-path>/extension.js:861:462725)
at async Lf.HOc (<REDACTED: user-file-path>/extension.js:865:21842)
at async Lf. (<REDACTED: user-file-path>/extension.js:14:389828)
at async jE (<REDACTED: user-file-path>/extension.js:1677:18054)
at async Object.Oyt [as callback] (<REDACTED: user-file-path>/extension.js:1699:17524)
at async e.runCommand (<REDACTED: user-file-path>/extension.js:1677:15869)
at async mw.h (file:///c:/Users/tarachev/AppData/Local/Programs/Microsoft VS Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:112:32733)

@microsoft-github-policy-service microsoft-github-policy-service bot added the needs attention This issue needs the attention of a contributor. label Mar 5, 2025
Copy link

👋 Hi @2BitSalute,

Thank you for reporting this issue! We want to let you know that:

⏱️ Our team will personally review your issue
🎯 You can expect a response within 2 business days

✨ This is an AI-generated initial response
🤖 AI-Generated Preliminary Analysis:

It seems that the error TypeError: Cannot read properties of undefined (reading 'schema') has been reported and addressed in several instances in the Teams Toolkit repository. The issue commonly arises when working with OpenAPI specifications or during the generation process in the Teams Toolkit.

Here are the recommended steps and workarounds based on retrieved resources:

Proposed Fixes and Solutions:

  1. Ensure Your OpenAPI Specification is Correct:

    • Validate your OpenAPI document to ensure it adheres to the correct format and version.
    • Correct any semantic issues that might cause the schema to be undefined.
  2. Check for Content and Schema Issues:

    • It's possible that the error is related to a specific content configuration within your OpenAPI spec (especially application/x-www-form-urlencoded).
    • Modify application/x-www-form-urlencoded to application/json temporarily to see if the issue persists.

    Example corrected OpenAPI snippet:

    openapi: 3.0.3
    info:
      title: Basic Form Submission API
      version: 1.0.0
    servers:
      - url: 
    paths:
      /submit-form:
        post:
          summary: Submit a form
          requestBody:
            required: true
            content:
              application/json:
                schema:
                  type: object
                  properties:
                    name:
                      type: string
                      description: The name of the user
                  required:
                    - name
          responses:
            '200':
              description: Form submitted successfully
              content:
                application/json:
                  schema:
                    type: object
                    properties:
                      message:
                        type: string
                        example: Form submitted successfully!
  3. Ensure Your Toolkit and Extensions are Up-to-date:

    • Make sure you are using the latest version of the Teams Toolkit.
    • Update any related extensions in your development environment (VS Code).
  4. Provide Required Metadata in OpenAPI Documentation:

    • Ensure all required metadata and references in your OpenAPI document are correctly filled.
    • Remove or update incorrect references or undocumented properties.

    Example correct OpenAPI metadata:

    openapi: 3.0.3
    info:
      title: Correct API
      version: 1.0.0
      description: An example API
    paths:
      /example:
        get:
          summary: Example endpoint
          responses:
            '200':
              description: Successful response

Next Steps:

  1. Reproduce Locally and Isolate the Issue:

    • Reproduce the issue in a controlled environment.
    • Isolate the part of the code or OpenAPI spec causing the issue by simplifying your document and adding back sections incrementally.
  2. Engage with the Community and Support:

    • Post your specific issue, along with reproducible steps and code snippets, on GitHub issues for more tailored assistance.
    • Refer to GitHub issues #12731 and #12767 for context and solutions provided by other developers.

By following these steps and referring to the solutions outlined, you should be able to troubleshoot and resolve the TypeError: Cannot read properties of undefined (reading 'schema') error in your Teams app development project. If the issue persists, consider reopening the relevant GitHub issue with detailed information to get more specific assistance.


Note: This is an automated first response generated by AI. A human team member will review your issue and provide a more detailed response soon. We appreciate your patience!

@Prasad-MSFT
Copy link

Hi @2BitSalute, could you please provide more details on your issue, such as documentation/sample you have referred to/tried out along with repro steps?

@2BitSalute
Copy link
Author

Sure thing, I thought you didn't need anything else since nothing else was logged or asked :)

I believe I started from the custom engine tutorial, but then decided to try the declarative agent first, just using the wizard in the extension:
https://learn.microsoft.com/en-us/microsoftteams/platform/teams-ai-library-tutorial?tutorial-step=1

This was on the pre-release version of the Teams Toolkit extension:

  Identifier: teamsdevapp.ms-teams-vscode-extension
  Version: 5.13.2025021807
  Last Updated: 2025-03-04, 18:02:43

The agent was supposed to have an action associated with it.

I chose the option to use an OpenAPI document, which was the downloaded version of this file: https://github.com/MicrosoftDocs/vsts-rest-api-specs/blob/8e0bf35364c7a26b0ff5979e9b87c521cf6a0ca0/specification/artifacts/7.2/feed.json

One thing is that I did not yet have the Kiota extension installed. Perhaps that affects the behavior or is a required dependency.
I was in a hands-on learning session earlier today, and based on that, I installed Kiota.

Since I've installed (the release version of) Kiota today, I tried again, and I didn't get any errors.

@SLdragon
Copy link
Contributor

SLdragon commented Mar 6, 2025

Hi, @2BitSalute , this error occurred in Teams Toolkit 5.12.1, but we have already fixed this issue in Teams Toolkit 5.13.x. I tried your specification, and it works fine now in version 5.13.x.

@adashen adashen added needs more info Need user to provide more info and removed needs attention This issue needs the attention of a contributor. labels Mar 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
investigating needs more info Need user to provide more info TA:Auth Team Area: Auth
Projects
None yet
Development

No branches or pull requests

4 participants