-
-
Notifications
You must be signed in to change notification settings - Fork 455
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
SSG not storing to s3 for dynamic pages with fallback: true #798
Comments
Thanks, looks like the problem is in here: serverless-next.js/packages/libs/lambda-at-edge/src/default-handler.ts Lines 361 to 369 in 84a3f40
Not sure why it wasn't caught in unit tests, I'll fix it and update both the unit/e2e tests to catch this. |
@dphang Got it! Well now it stores on s3🥇 . You are doing very great 👍 Just a comment, It may occur that if you just return I may open a thread for this, but who cares. |
Thanks for testing. I actually didn't publish the latest yet. I did find that issue too, it is because fallback page gets cached after 1st hit. But if you bust the cache after hitting a non-prerendered route (add a random query parameter), with the new change it would pick up the page that was just stored in s3, so all props are populated. To fix it, we need to make the fallback page never cached, so the lambda can return the newly generated page (and cache it) the next time the same route is hit. But we also need to version the pages properly as I realized we are not clearing them properly (we only have one set of pages under static-pages, so subsequent deploys may pick up an old version). |
@dphang we tested with the PR.
Absolutely, it makes sense since in the end what users request is cached, still up-to-date versions at the edges. Keep up 💯 |
@arelaxend Can you tell me how you are uploading your static generated files to s3. Right now, what I am doing is after build I upload all the static files and folder on S3 and do |
@rahul3103 can you create a request / issue following the instructions and check that your question has no precedence. Thank you |
Im having the same problem. Thanks |
Hi people,
Describe the bug
Say, we have dynamic pages
/test/[id].js
with somegetStaticPaths(...fallback: true)
andgetStaticProps(...)
. When we request a new id, it renders the html correctly after a loading but it does not store anything on s3.So, SSG is not working here!
We suspect that it does not deal multi-regions correctly, but we actually don't know. Please read what follows.
Actual behavior
Nothing is stored in s3 when
fallback:true
for pages/test/xxx
not statistically generated at build time. But it does work inlocalhost
.Expected behavior
After a hit, subsequent requests just follow the RFC that is get from s3, hit, render.
Additional information
We tested this with the following in
/test/[id].tsx
The content of
/static-pages/test/[id].html
is the following:The content of
_next/static/QTXnzCYbWqOui3ql6FK75/_buildManifest.js:
The content of
_next/static/QTXnzCYbWqOui3ql6FK75/_ssgManifest.js
is:When I test the results of this with the following url: https://e.docduo.fr/test/59407fcb-a848-4ab5-95f0-019f613ea0c1
I expect to have something store in s3 after the first hit.. but in the s3 folder there is just:
The lambda function (we only see one lambda, Default @ Lambda/Edge, no API) has the following permissions (we also test with administrator permissions, does not work).
Strangely, there is no lambda invocation (on us-east-1, where the plugin creates the lambda)
The serverless includes a domain where we issue a certificate in
us-east-1
Also maybe this is relevant, the cloudwatch logs are in
ue-west-1
:But the plugin setups one lambda in
us-east-1
.In cloudfront, under
_next/data*
we have this setup (automatically by the plugin, it looks nice)Under s3, there is the following perms:
Versions
Checklist
A.
The text was updated successfully, but these errors were encountered: