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]: Bad. Sad. error on bal graphql -i service.bal #43496

Open
Ishad-M-I-M opened this issue Oct 20, 2024 · 0 comments
Open

[Bug]: Bad. Sad. error on bal graphql -i service.bal #43496

Ishad-M-I-M opened this issue Oct 20, 2024 · 0 comments
Labels
needTriage The issue has to be inspected and labeled manually Type/Bug

Comments

@Ishad-M-I-M
Copy link
Contributor

Description

Bad. Sad. error is thrown when tried to generate schema using the ballerina graphql service using command line

Steps to Reproduce

Example graphql service.
service.bal

import ballerina/graphql;

configurable int port = 9090;

public type User record {|
    string id;
    string name;
|};

service / on new graphql:Listener(port) {
    resource function get user(string id) returns User? {
        return {
            id: "1",
            name: "Jhon",
        };
    }
}

Command executed.

bal graphql -i service.bal -o schema.graphql

Error:

ballerina: Oh no, something really went wrong. Bad. Sad.

We appreciate it if you can report the code that broke Ballerina in
https://github.com/ballerina-platform/ballerina-lang/issues with the
log you get below and your sample code.

We thank you for helping make us better.

[2024-10-20 20:49:49,395] SEVERE {b7a.log.crash} - The source file '<path>/service.bal' belongs to a Ballerina package. 
io.ballerina.projects.ProjectException: The source file '<path>/service.bal' belongs to a Ballerina package.
        at io.ballerina.projects.internal.ProjectFiles.validateSingleFileProjectFilePath(ProjectFiles.java:390)
        at io.ballerina.projects.internal.PackageConfigCreator.createSingleFileProjectConfig(PackageConfigCreator.java:94)
        at io.ballerina.projects.internal.PackageConfigCreator.createSingleFileProjectConfig(PackageConfigCreator.java:109)
        at io.ballerina.projects.directory.SingleFileProject.load(SingleFileProject.java:56)
        at io.ballerina.projects.directory.ProjectLoader.loadProject(ProjectLoader.java:101)
        at io.ballerina.projects.directory.ProjectLoader.loadProject(ProjectLoader.java:41)
        at io.ballerina.graphql.schema.generator.SdlSchemaGenerator.generate(SdlSchemaGenerator.java:79)
        at io.ballerina.graphql.cmd.GraphqlCmd.generateSchema(GraphqlCmd.java:327)
        at io.ballerina.graphql.cmd.GraphqlCmd.executeOperation(GraphqlCmd.java:257)
        at io.ballerina.graphql.cmd.GraphqlCmd.execute(GraphqlCmd.java:164)
        at java.base/java.util.Optional.ifPresent(Optional.java:178)
        at io.ballerina.cli.launcher.Main.main(Main.java:59)

Affected Version(s)

Ballerina 2201.10.1 (Swan Lake Update 10)
Language specification 2024R1
Update Tool 1.4.3

OS, DB, other environment details and versions

OS: Fedora 40

Related area

-> Other Area

Related issue(s) (optional)

No response

Suggested label(s) (optional)

No response

Suggested assignee(s) (optional)

No response

@ballerina-bot ballerina-bot added the needTriage The issue has to be inspected and labeled manually label Oct 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needTriage The issue has to be inspected and labeled manually Type/Bug
Projects
None yet
Development

No branches or pull requests

2 participants