Replies: 1 comment
-
Hey @bytrangle, thanks for the comment! As this are just meant to be used as guidance we can assume that the file will always be there. Although I feel that adding a catch would make more sense, I prefer to leave it like this to give more focus on the example related code, but of course, if we see this happens to more people we can add it! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
First off, thank you very much for putting up a great example for sharing responses from
getStaticPaths
togetStaticProps
.I have a question regarding the use of
cache.get()
method.getStaticPaths
only writes to cache at build time. However, ingetStaticProps
, you try to read from cache unconditionally. If the cache file doesn't exist, thenfs.promises
will throw an error "ENOENT No such file or directory at ...".For now, anyone trying out this demo won't get that error because you've added a placeholder file
products.db
.Should we add a
catch
block to thecache.get()
method? Or only read from cache if it is build time?Beta Was this translation helpful? Give feedback.
All reactions