aws-amplify / amplify-hosting

AWS Amplify Hosting provides a Git-based workflow for deploying and hosting fullstack serverless web applications.
https://aws.amazon.com/amplify/hosting/
Apache License 2.0
448 stars 113 forks source link

Next.js 13 - Manual deploys via zip file #3195

Open basselabbara opened 1 year ago

basselabbara commented 1 year ago

Before opening, please confirm:

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

ghost commented 1 year ago

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

github-actions[bot] commented 1 year ago

⚠️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] commented 1 year ago

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!

lbustelo commented 1 year ago

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 commented 1 year ago

@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?

yanlin96 commented 1 year ago

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.

arturkasperek commented 1 year ago

Is it possible to use the ZIP approach in 2023?

FaijanSaifi99 commented 1 year ago

Is it possible to use the ZIP approach in 2023?

i have tried it. but did not work.

arturkasperek commented 1 year ago

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 commented 1 year ago

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

tmokmss commented 9 months ago

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?

inthegreenwild commented 5 months ago

+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

haarism commented 5 months ago

+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.

j-boivie-rs commented 4 months ago

+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.

lbustelo commented 2 months ago

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.

sundeep-paulraj commented 4 weeks ago

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

arturkasperek commented 2 weeks ago

Any news ?

FaijanSaifi99 commented 2 weeks ago

Nope. I had to connect my github repo.

wolfgang000 commented 1 week ago
FaijanSaifi99 commented 1 week ago

I recently visited on amplify and i saw the option for manual deployment but only for static site generation.

mauerbac commented 18 hours ago

Hey everyone -- Matt from the Amplify Hosting team here. @FaijanSaifi99 @wolfgang000 @arturkasperek @sundeep-paulraj @lbustelo @j-boivie-rs @haarism @inthegreenwild

I know everyone wants an update here! The team is currently scoping this feature and I have a question to ask everyone.

What workflow do you plan to use this feature with? Meaning, we would need the build output to conform to our SSR deployment specification, listed here. Would you expect a CLI tool that you can run so the files are built in the correct format? Or would you add this into your own build pipeline?

Thank you

arturkasperek commented 18 hours ago

@mauerbac I prefere an option where I can own full process and build everything on my CI/CD. I think we should just send a ZIP. You can create some standalone tool which will transform nextjs build folder into yours format

basselabbara commented 16 hours ago

@mauerbac a CLI tool would be awesome. Perhaps one that can package and deploy straight to Amplify. Thanks!

lbustelo commented 15 hours ago

@mauerbac Being able to control the build independent of deployment would be ideal.

  1. Use some library from Amplify to build a standard NextJS app into a build output that conforms to what Amplify needs.
  2. That build output could them be uploaded to an S3 bucket
  3. Use Amplify to configure a new application to deploy the NextJS build from said S3 location
haarism commented 5 hours ago

@mauerbac Would you consider the following capabilities: