-
Notifications
You must be signed in to change notification settings - Fork 18
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
External source images are not responded from the repeated requests #12
Comments
Strange, currently I don't get why this works in the e2e:tests (they aren't using etags either). Would welcome a PR for this since I don't have much time the next 2 weeks to fix it by myself 👍 |
@ofhouse Wrong response' status is 200 but binary data is empty. The expected e2e test that should catch this problem is |
It would probably make sense to create a new test block for this case since it doesn't make sense to run through all fixtures for this. |
…ng-response-when-repeated-requests-for-external-source fix wrong response when repeated requests for external source (#12)
Test environment
In
examples/with-next-js
, I modifymain.tf
file like below:then
terraform apply
done successfully.External source image: https://cdn11.bigcommerce.com/s-qfzerv205w/images/stencil/original/products/116/512/Men-Jacket-Front-Black__15466.1603283963.png
Test url: https://d1phddo1jfr778.cloudfront.net/_next/image/?url=https%3A%2F%2Fcdn11.bigcommerce.com%2Fs-qfzerv205w%2Fimages%2Fstencil%2Foriginal%2Fproducts%2F116%2F512%2FMen-Jacket-Front-Black__15466.1603283963.png&w=760&q=94
(
d1phddo1jfr778.cloudfront.net
will be destroyed in a few days)Expected behavior
All repeated requests could get download images.
Current behavior
Requests with ETag header (with browser cache) works well.
But cache clear environments(without ETag) can not get images.
I use chrome browser Incognito mode for cache clear.
Solution
I reviewed code in this repo and nextjs image-optimizer then finally found a suspicious point.
I Think in the
./lib/handler.ts
handler function's return should wait steam write. (next image-optimizer usereadStream.pipe(res)
)@ofhouse Could I make PR?
The text was updated successfully, but these errors were encountered: