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

Support for VikeJS

Open charlieforward9 opened this issue 1 year ago • 8 comments

Before opening, please confirm:

App Id

d104w4v8nmd5no

AWS Region

us-east-2

Amplify Hosting feature

SSR

Question

I would like to be able to access my site through the production link provided through Amplify Hosting. I am using Vite with Vite SSR Plugin for frontend tooling.

Build Settings
version: 1
backend:
  phases:
    build:
      commands:
        - '# Execute Amplify CLI with the helper script'
        - amplifyPush --simple
        - # Rename .js file to be properly called
        - mv src/aws-exports.js src/aws-exports.ts
frontend:
  phases:
    preBuild:
      commands:
        - npm ci
    build:
      commands:
        - npm run build #(calls vite build)
  artifacts:
    # IMPORTANT - Please verify your build output directory
    baseDirectory: dist/client
    files:
      - '**/*'
  cache:
    paths:
      - node_modules/**/*

Build Folder Architecture Screen Shot 2023-05-23 at 9 30 40 AM

I also changed my Amplify config to Amplify.configure({ ...awsExports, ssr: true });

I read that Amplify automatically detects when using SSR, how could I configure my application to match this spec?

Currently, when I run a build. It succeeds but my site fails to show content

(@Brillout)

charlieforward9 avatar May 23 '23 13:05 charlieforward9

Hi @charlieforward9 👋🏽 thanks for raising this issue. At this time, Amplify Hosting only supports SSR applications that leverage the Next.js framework:

You can use AWS Amplify to deploy and host web apps that use server-side rendering (SSR). Currently, Amplify Hosting supports apps created using the Next.js framework. When you deploy your app, Amplify automatically detects SSR–you do not have to perform any manual configuration in the AWS Management Console.

We can take this as a feature request to support vite-plugin-ssr in the future.

ghost avatar May 23 '23 18:05 ghost

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 May 23 '23 18:05 github-actions[bot]

@hloriii Hello, thank you for the response! Amplify team is certainly occupied with other tickets, as I see there are about 600 open issues at the moment. However, I am curious to know a timeline, if you're able to provide one... I would like to be able to report a general projection to my team.

charlieforward9 avatar May 23 '23 18:05 charlieforward9

Author of vite-plugin-ssr here. I appreciate that you're considering adding support for other frameworks other than Next.js — let me know if there is something that can be done on vite-plugin-ssr's side.

brillout avatar May 23 '23 18:05 brillout

Hoping to continue this discussion as I may be running into issues around this. https://github.com/brillout/vite-plugin-ssr/discussions/934

charlieforward9 avatar Jun 03 '23 21:06 charlieforward9

I ran into similar issues in the past when using SSR + Amplify. But recently gave it another shot and got a Vite SSR build working and hosted with amplify-hosting, check it out: https://github.com/bebeal/vite-amplify this leads me to believe Vike should work with it as well

bebeal avatar Jul 29 '24 03:07 bebeal

@brillout @ghost my applications specs are making ssr a tempting option right now. Has there any discussion or work into an integration potential?

charlieforward9 avatar Sep 04 '24 19:09 charlieforward9

We've recently added AWS to Bati, but I don't think it uses Amplify. Other than that no news on my side.

brillout avatar Sep 04 '24 19:09 brillout