amplify-hosting icon indicating copy to clipboard operation
amplify-hosting copied to clipboard

Next.js 13 - Manual deploys via zip file

Open basselabbara opened this issue 2 years ago • 25 comments

Before opening, please confirm:

  • [X] I have checked to see if my question is addressed in the FAQ.
  • [X] I have searched for duplicate or closed issues.
  • [X] I have read the guide for submitting bug reports.
  • [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
  • [X] I have removed any sensitive information from my code snippets and submission.

App Id

d113cc0qzdxa93

AWS Region

us-east-1

Amplify Hosting feature

Deployments

Describe the bug

Trying to upload a zip build of Next.js with SSR. It says deployment successful but the environment URL says Access Denied.

Expected behavior

The URL should show the Next app instead of Access Denied.

Reproduction steps

  1. Go to any environment URL of the app.

Build Settings

No response

Log output

# Put your logs below this line
2022-12-12T18:21:36 [INFO]: Starting Deployment
2022-12-12T18:21:37 [INFO]: Updating Edge config
n, buildId 0000000008
2022-12-12T18:21:37 [INFO]: Got archive: 29260413 bytes
2022-12-12T18:21:46 [INFO]: Deployment complete

Additional information

No response

basselabbara avatar Dec 12 '22 19:12 basselabbara

Hi @basselabbara 👋🏽 Apologies for this inconvenience but Amplify Hosting currently doesn't support manually deploying SSR apps: https://docs.aws.amazon.com/amplify/latest/userguide/manual-deploys.html.

Please follow this guide instead to deploy Next.js apps with Amplify: https://docs.aws.amazon.com/amplify/latest/userguide/deploy-nextjs-app.html

ghost avatar Dec 12 '22 21:12 ghost

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.

github-actions[bot] avatar Dec 13 '22 03:12 github-actions[bot]

This has been identified as a feature request. If this feature is important to you, we strongly encourage you to give a 👍 reaction on the request. This helps us prioritize new features most important to you. Thank you!

github-actions[bot] avatar Dec 13 '22 03:12 github-actions[bot]

I wanted to add that this should not be exclusive to NextJS 13... would be great if it supported NextJS 12 as well.

Additionally, it would be great to trigger a deployment from an S3 package using CDK.

lbustelo avatar Dec 20 '22 20:12 lbustelo

@hloriana I've been having discussions with support about this exact feature. In theory, it seems that there should not be any technical reason why we can't deploy Next JS SSR app using upload of files or S3, as long as the files are organized in some expected way.

It seems that Amplify Hosting does the following:

  1. Identifies the type of project it is hosting based on the content. There may be some hardcoded rules based on project source (ie. Git vs S3), but regardless, it seems that these can be modified through CLI
aws amplify update-app --app-id <app_id> --platform WEB_COMPUTE
aws amplify update-branch --app-id <app_id> --branch-name <branch_name>  --framework 'Next.js - SSR'
  1. Build of assets. In terms of Next JS, this would be a next build with some additional AWS specifics steps to build whatever is needed to deploy Lambda@Edge.

  2. Infrastructure deployment. S3, CloudFront, Lambda@Edge, IAM, etc...

If I can configure the App properly using commands above and also perform a build on my end that mimics #2, could it be then possible for me to upload the output of that build using Manual approach (DnD files or S3) and trigger #3?

lbustelo avatar Dec 21 '22 19:12 lbustelo

Hi team,

I did a test with git repo with "web_dynamic". And In the building phase, I notice a new "serverless" folder is generated by Amplify in the artifacts.zip for the following deployment.

Looks like the only difference in the .next and artifacts.zip is the "serverless" folder.

Therefore, maybe Amplify could have the ability to know the manually uploaded zip files is from Nextjs project in the building phase, then somehow generating the "serverless" folder for the following deployment.

yanlin96 avatar Dec 21 '22 23:12 yanlin96

Is it possible to use the ZIP approach in 2023?

arturkasperek avatar Mar 22 '23 13:03 arturkasperek

Is it possible to use the ZIP approach in 2023?

i have tried it. but did not work.

FaijanSaifi99 avatar Jun 13 '23 05:06 FaijanSaifi99

As a workaround, my CI/CD process push thing to AWS codecommit. I think it should be possible to upload ZIP to support different CI/CD use cases

arturkasperek avatar Jun 20 '23 07:06 arturkasperek

any update? Forcing to use amplify CI/CD wouldn't work for all organization cause not everyone wanna stick fully with amplify CI/CD

arturkasperek avatar Jul 25 '23 08:07 arturkasperek

This feature is highly desired for consistent use of Amplify Hosting from AWS CDK. Given that we can deploy an SPA app from CDK s3 asset to Amplify Hosting (doc), why not for SSR apps?

tmokmss avatar Nov 21 '23 10:11 tmokmss

+1 to this feature I have a case where it would be very benificial to manually deploy a Nuxt 3 app with SSR enabled rather than having to go through ci/cd amplify console

inthegreenwild avatar Mar 27 '24 14:03 inthegreenwild

+1 to this feature I have a case where it would be very benificial to manually deploy a Nuxt 3 app with SSR enabled rather than having to go through ci/cd amplify console

It is worth noting that, although not via inbuilt amplify API it is possible to download the build from an artifact repo like AWS CodeArtifact. Avoiding @aws-sdk/* NodeJS SDK in your webapp build will reduce the total artifact size. And move @aws-sdk/client-codeartifact into a different package that can download this using OIDC federation, and right permission setup on the amplify role. I use Next.js ISR and this works just fine.

But I would still like to see this feature to inbuilt in AWS APIs - aws cli and aws_amplify_app terraform.

haarism avatar Mar 28 '24 06:03 haarism

+1 on this. Manually deploying a SSR app would be really valuable for my use case, otherwise I would need to support two different CI/CD envs for devs, depending on whether they work on SSR apps or not.

j-boivie-rs avatar Apr 17 '24 08:04 j-boivie-rs

Is this still on the radar? Last thing I heard from AWS rep was that this was going to be announced in re:Invent 2023. Came and went. I know AWS does not want to share/commit to roadmaps, but a little bit of news here would help.

lbustelo avatar Jun 12 '24 14:06 lbustelo

+1, manual deployment for SSR via zip files would be helpful

sundeep-paulraj avatar Aug 08 '24 03:08 sundeep-paulraj