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

GraphQL multiple file upload returns NPE #2500

Closed
DimuthuMadushan opened this issue Dec 16, 2021 · 0 comments · Fixed by ballerina-platform/module-ballerina-graphql#527
Closed
Assignees
Labels
module/graphql Issues related to Ballerina GraphQL module Points/1.5 Team/PCM Protocol connector packages related issues Type/Bug

Comments

@DimuthuMadushan
Copy link

DimuthuMadushan commented Dec 16, 2021

Description:
consider the following service:

service /fileUpload on new graphql:Listener(9000) {
    remote function multipleFileUpload(graphql:Upload[] files) returns string[]|error {
        string[] fileInfo = [];
        foreach int i in 0..< files.length() {
            graphql:Upload file = files[i];
            check io:fileWriteBlocksFromStream(string`./files/${file.fileName}`, file.byteStream);
            fileInfo.push(file.fileName);
        }
        return fileInfo;
    }
}

This can be query as follow:

curl localhost:9000/fileUpload   
-F operations='{ "query": "mutation($file: [Upload!]!) { multipleFileUpload(files: $file) }", "variables": { "file": [null, null, null] } }'   
-F map='{ "0": ["file.0"], "1":["file.1"], "2":["file.2"]}' 
-F [email protected]
-F [email protected] 
-F [email protected]

Currently, this returns an NPE.

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 Points/1.5 Team/PCM Protocol connector packages related issues Type/Bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants