Closed nebnes closed 4 years ago
There is not enough information in this issue to be able to help. What is "sequelize"? What does uploadFileToBucket
do? What is File
, and why would you seemingly create and return a dummy file unrelated to the earlier upload?
@jaydenseric
Here is a simplify example. I seem that I can't run promise in the resolver :
This doesn't work :
const sleep = _time => {
return new Promise((res, rej) => {
setTimeout(() => {
res();
}, _time);
});
};
const resolve = async (request, args) => {
const { file } = args;
const { filename, createReadStream } = await file;
const stream = createReadStream();
await sleep(100);
return "hello";
});
This works :
const resolve = async (request, args) => {
const { file } = args;
const { filename, createReadStream } = await file;
const stream = createReadStream();
return "hello";
});
This doesn't work
What does that mean, is there an error?
Please see the tips:
https://github.com/jaydenseric/graphql-upload#tips
In both of those code examples the file stream is neither promisified and awaited, or destroyed. Not handling the streams correctly will cause all sorts of problems.
Thanks for your time. It's the first implementation of graphql-upload for me. I have follow the readme. I didn't find yet what is wrong on my side. Even if I destroy the stream :
const sleep = _time => {
return new Promise((res, rej) => {
setTimeout(() => {
res();
}, _time);
});
};
const resolve = async (request, args) => {
const { file } = args;
const { filename, createReadStream } = await file;
const stream = createReadStream();
stream.destroy();
await sleep(100);
return "hello";
});
The resolver no resolve : return nothing.
If you run npm ls graphql-upload
, is there only one version in node_modules
, and is it the latest?
└── graphql-upload@11.0.0
Yes
What is the full JSON response, and HTTP status code?
I have find something. My bad the issue come from my client part. I have debug with altair and it's seem ok. HTTP status 200 and JSON valid Thanks for your time !
Glad you got it working :)
When I call a sequelize operation here for example : "
await File.create({name:"test"})
" The resolver is block and return nothing. If I remove the sequelize line. It's works..Do you know why I can't call sequelize ?
Setup : graphql-express