Replies: 3 comments 10 replies
-
I would go as far as to say this is close to impossible that this is what's actually happening 😅 I mean, it is much more likely that you are sending the wrong requests in JS? How could request 2 have the data of request 3 when request 3 is not even sent? |
Beta Was this translation helpful? Give feedback.
-
Indeed, that's exactly what I would think. The production application is running in a typical environment with a load balancer and multiple EC2 instances. I'm using identical code, an identical database, and the only difference here is the bref/lambda execution environment. If it were something wrong with the JS alone, it would be happening with both the lambda and the EC2 environment. Here are screenshots of the requests in the console, with the content of $_GET printed out from the PHP. The request query is highlighted with the response on the right. This only seems to happen when the 3 requests are chronologically close together. I can put the URLs in the browser address bar and see correct output. I've tried using both ${bref:layer.php-73-fpm} and ${bref:layer.php-74-fpm}, but the result is the same. I'm using the "serverless-lift" plugin, so the request/response is also going through CloudFront. Is there anything I can output that would explain why this is happening? |
Beta Was this translation helpful? Give feedback.
-
I think it's because those are "same second requests" so cloudfront tries to use cache on them even though the cache policy default to a TTL of zero. This almost look like a bug on cloudfront side. You could try to include the query string in the cache behavior to see if it changes something? You could also try to set cache headers explitly in your code to disable caching. |
Beta Was this translation helpful? Give feedback.
-
Hello there!
I've been testing Bref out, and so far I love it. But I've run into an issue that is a definite show-stopper. I'm hoping someone might have some guidance here because it's pretty unusual.
I have a web page that makes 3 XHR requests to the same endpoint with different URL parameters. On that endpoint, I print out the content of the $_REQUEST array. Here are the URL parameters of each request, followed by the output from the $_REQUEST array:
== REQUEST 1 ==
Params:
?id=3442&categoryId=setup
$_REQUEST:
Array
(
[id] => 3442
[categoryId] => setup
)
== REQUEST 2 ==
Params:
?id=3442&categoryId=instructions
$_REQUEST:
Array
(
[id] => 3442
[categoryId] => safety
)
== REQUEST 3 ==
Params:
?id=3442&categoryId=safety
$_REQUEST:
Array
(
[id] => 3442
[categoryId] => safety
)
As you can see, the second request's URL parameters and $_REQUEST array don't match up. This happens persistently.
When I print out $_SERVER['REQUEST_URI'], I see ?id=3442&categoryId=safety
But the browser request is /ajax/activity/loadBlocks/?id=3442&categoryId=instructions
I also printed out the content of $_SERVER['LAMBDA_INVOCATION_CONTEXT'], and the last two requests share exactly the same context information.
If I make a direct request to the endpoint in the browser (not through AJAX), I see the results I would expect.
It's very unusual. Can anyone shed some light on how this could happen and what could be done about it?
Beta Was this translation helpful? Give feedback.
All reactions