Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy Steps failure #2073

Open
4 tasks done
tajindersinghminhas opened this issue Jul 20, 2021 · 6 comments
Open
4 tasks done

Deploy Steps failure #2073

tajindersinghminhas opened this issue Jul 20, 2021 · 6 comments
Labels
ssr Server Side Rendering feature

Comments

@tajindersinghminhas
Copy link

Before opening, please confirm:

App Id

d3eyxgyk7b3qii

Region

us-east-2

Amplify Console feature

Build settings

Describe the bug

2021-07-20T19:06:56 [INFO]: Beginning deployment for application d3eyxgyk7b3qii, branch:dev, buildId 0000000317
2021-07-20T19:06:56 [INFO]: Cannot find any generated SSR resources to deploy. If you intend for your app to be SSR, please check your app Service Role permissions. Otherwise, please check out our docs on how to setup your app to be detected as SSG (https://docs.aws.amazon.com/amplify/latest/userguide/server-side-rendering-amplify.html#deploy-nextjs-app)

Expected behavior

Deploy step should be finished successfully

Reproduction steps

  1. Commit anything to the code repo
  2. Deploy, build setting is successful and it fails through Deploy step with following error

2021-07-20T19:06:56 [INFO]: Beginning deployment for application d3eyxgyk7b3qii, branch:dev, buildId 0000000317
2021-07-20T19:06:56 [INFO]: Cannot find any generated SSR resources to deploy. If you intend for your app to be SSR, please check your app Service Role permissions. Otherwise, please check out our docs on how to setup your app to be detected as SSG (https://docs.aws.amazon.com/amplify/latest/userguide/server-side-rendering-amplify.html#deploy-nextjs-app)

It started failing since yesterday but it has been working before that.

Build Settings

version: 1
frontend:
  phases:
    preBuild:
      commands:
        - npm install
    # IMPORTANT - Please verify your build commands
    build:
      commands:
        - npm run build
  artifacts:
    # IMPORTANT - Please verify your build output directory
    baseDirectory: out
    files:
      - "**/*"
  cache:
    paths:
      - node_modules/**/*

Additional information

This our build steps


    "web": "node scripts/set-next-env-config.js $npm_config_env dev",
    "build": "node scripts/set-next-env-config.js $npm_config_env build && next build && next export",
    "start-web": "node scripts/set-next-env-config.js $npm_config_env start",

and following code is used for setting environment variables, but it is not executed at the moment with amplify settings:

`#!/bin/node
const fs = require("fs");
const childProcess = require("child_process");

const environment = process.argv[2];

const nextCommand = process.argv[3];

let envPath = "";
if (environment == "local") envPath = "env/.env.local";
else if (environment == "dev") envPath = "env/.env.development";
else if (environment == "prod") envPath = "env/.env.production";
else if (environment == "preview") envPath = "env/.env.preview";
else envPath = "env/.env.development";
console.log("testing", environment);
if (environment == "local") {
nextBuild((message) => {
console.log(message);
if (nextCommand === "build") {
nextExport((message) => {
console.log(message);
});
}
});
} else {
try {
const file = fs.readFileSync(envPath, "utf8");
if (file) {
fs.writeFileSync(".env", file);
}
} catch (err) {
console.log(err);
}
// nextBuild((message) => {
// console.log(message);
// if (nextCommand === "build") {
// nextExport((message) => {
// console.log(message);
// });
// }
// });
}

function nextBuild(onSuccess) {
childProcess
.spawn("env-cmd", ["-f", envPath, "next", nextCommand], {
stdio: "inherit",
shell: true,
})
.on("exit", function (error) {
if (!error) {
onSuccess("----- Build Success! -----");
}
});
}

function nextExport(onSuccess) {
childProcess
.spawn("env-cmd", ["-f", envPath, "next", "export"], {
stdio: "inherit",
shell: true,
})
.on("exit", function (error) {
if (!error) {
onSuccess("----- Exported Successfully -----");
}
});
}`

@github-actions
Copy link

Hi 👋, thanks for opening! While we look into this...

If this issue is related to custom domains, be sure to check the custom domains troubleshooting guide to see if that helps. Also, there is a more general troubleshooting FAQ that may be helpful for other questions.

Lastly, please make sure you've specified the App ID and Region in the issue!

@paulcookie
Copy link

Same case man, looks like Amplify switch to SSR mode instead-of SSG, and I have no clue how to turn it back to SSG as it was previously

@paulcookie
Copy link

paulcookie commented Jul 22, 2021

Man I found solution here https://github.com/aws-amplify/amplify-console/blob/master/FAQ.md#convert-an-ssr-app-to-ssg
it really tricky, it uses magic strings such as Next.js - SSG - Amplify or Next.js - SSG

@paulcookie
Copy link

I believe that AWS team will place this option in UI instead of just cover it in CLI and a few lines in FAQ

@ferdingler ferdingler added the ssr Server Side Rendering feature label Jul 22, 2021
@ferdingler
Copy link
Contributor

Hi, @paulcookie is correct, this is our current workaround for switching an app from SSR back to SSG: https://github.com/aws-amplify/amplify-console/blob/master/FAQ.md#convert-an-ssr-app-to-ssg. What happens is that at some point your app was created as SSR but now it's being built as SSG because of the next export command in the build script.

If you intend for the app to continue as SSG, please follow the steps above for now.

@ACPK
Copy link

ACPK commented Aug 16, 2021

Any updates on this? Our website has never been SSR. AWS fixed this for us twice but we have hit it again for the first time. The issue seems to occur for us every five weeks.

@ghost ghost added the s3 label Jan 27, 2023
@ghost ghost removed the s3 label Mar 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ssr Server Side Rendering feature
Projects
None yet
Development

No branches or pull requests

6 participants