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

Can't use GraphiQL when SSL is enabled with a configurable variable for port #6459

Closed
MaryamZi opened this issue Apr 29, 2024 · 1 comment · Fixed by ballerina-platform/module-ballerina-graphql#1850
Assignees
Labels
module/graphql Issues related to Ballerina GraphQL module Reason/EngineeringMistake The issue occurred due to a mistake made in the past. Type/Bug
Milestone

Comments

@MaryamZi
Copy link
Member

Description:
$title.

Steps to reproduce:

  1. when I give the configurable variable directly and pass the secureScoket argument directly, I get a compile-time error.
configurable int port = 9000;

listener graphql:Listener ln = new (port,
        secureSocket = {
            key: {
                certFile: "../resources/certs/public.crt",
                keyFile: "../resources/certs/private.key"
            }
        });
ERROR [service.bal:(41:9,46:10)] http:Listener and graphql:ListenerConfiguration are mutually exclusive
  1. when I use an http:Listener to avoid this, GraphiQL doesn't work (errors like NetworkError when attempting to fetch resource., Failed to fetch)
listener graphql:Listener ln = new (check new http:Listener(port, 
        httpVersion = http:HTTP_1_1,
        secureSocket = {
            key: {
                certFile: "../resources/certs/public.crt",
                keyFile: "../resources/certs/private.key"
            }
        }));

Note:

  1. works when using a Ballerina GraphQL client (e.g., tests work)
  2. the log that is printed for GraphiQL is wrong - http instead of https - GraphiQL client ready at http://localhost:9000/graphiql

Affected Versions:
2201.9.0-rc2

@MaryamZi MaryamZi added Type/Bug module/graphql Issues related to Ballerina GraphQL module labels Apr 29, 2024
@ThisaruGuruge ThisaruGuruge moved this to Planned for Sprint in Ballerina Team Main Board Apr 29, 2024
@ThisaruGuruge
Copy link
Member

This seems like an issue when validating the port in the compiler plugin. It checks whether the first argument is a numeric literal. If that's not the case, the compiler plugin throws an error assuming it is an HTTP listener. But in this case, the port is passed as a variable.

We need to update this check to correctly validate the first argument.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module/graphql Issues related to Ballerina GraphQL module Reason/EngineeringMistake The issue occurred due to a mistake made in the past. Type/Bug
Projects
Archived in project
2 participants