Deployment troubles
Unanswered
Transylvanian Hound posted this in #help-forum
Transylvanian HoundOP
So I'm using SST.dev to deploy Next to AWS, and develop alongisde AWS lambdas. I have a Ci/CD setup using seed.run.
The first step in the deployment is to build the Next app. At this point the API is not deployed, so there are many build errors. I've tried to work around it to make sure the app still builds even without a data feed. And this works for the most part. I'm just wondering if anyone else has a similiar experience?
The first step in the deployment is to build the Next app. At this point the API is not deployed, so there are many build errors. I've tried to work around it to make sure the app still builds even without a data feed. And this works for the most part. I'm just wondering if anyone else has a similiar experience?
9 Replies
@Transylvanian Hound So I'm using SST.dev to deploy Next to AWS, and develop alongisde AWS lambdas. I have a Ci/CD setup using seed.run.
The first step in the deployment is to build the Next app. At this point the API is not deployed, so there are many build errors. I've tried to work around it to make sure the app still builds even without a data feed. And this works for the most part. I'm just wondering if anyone else has a similiar experience?
likely this is your bug: https://nextjs-faq.com/fetch-api-in-rsc
Transylvanian HoundOP
Hmm interesting.
Here's an example component.
export const Cards: React.FC<IDataCardsProps> = async ({ data }) => {
const res = await data()
.....
Where data is an async fetch function I pass in as a prop. In the parent I'm wrapping the component in suspense:
<Suspense fallback={<TokenListSkeleton />}>
<Cards data={object.method} />
</Suspense>
object.method() calls a fetch to an API gateway
Here's an example component.
export const Cards: React.FC<IDataCardsProps> = async ({ data }) => {
const res = await data()
.....
Where data is an async fetch function I pass in as a prop. In the parent I'm wrapping the component in suspense:
<Suspense fallback={<TokenListSkeleton />}>
<Cards data={object.method} />
</Suspense>
object.method() calls a fetch to an API gateway
does it work if you run
* if yes: it's a problem with SST and im unable to help, sorry about that
* if no: it's a bug in your code, please make a [minimal reproduction repository](https://l.joulev.dev/mrr)
next build locally?* if yes: it's a problem with SST and im unable to help, sorry about that
* if no: it's a bug in your code, please make a [minimal reproduction repository](https://l.joulev.dev/mrr)
Transylvanian HoundOP
Yes it builds fine. And I can deploy fine. Now. But that's because I've made my app not fail a build if the data is not present.
My question really is, if you're building a next app and it's using an external API source which could be unavailable, would you expect the build to break. And also am I missing out on prefetching the data during the build.
My question really is, if you're building a next app and it's using an external API source which could be unavailable, would you expect the build to break. And also am I missing out on prefetching the data during the build.
@Transylvanian Hound Yes it builds fine. And I can deploy fine. Now. But that's because I've made my app not fail a build if the data is not present.
My question really is, if you're building a next app and it's using an external API source which could be unavailable, would you expect the build to break. And also am I missing out on prefetching the data during the build.
would you expect the build to breakyes. without the necessary data, nextjs is unable to generate your pages => the build breaks
ensure all data dependencies are available and online when you build your app
Transylvanian HoundOP
yes ok thank you. that's what i thought. SST discord is not helpful. I simply need the API to deploy before the app is built, but it's not obvious how to do that
yeah you are right, that's what you need to do. but how to do that i have no idea so im afraid you'll need to wait for someone else. good luck!
Transylvanian HoundOP
thanks 🙂