#✅ - Artifact directory doesn't exist

60 messages · Page 1 of 1 (latest)

silent karma
#

amplify.yml

version: 1
applications:
    -
        backend:
            phases:
                build:
                    commands: ['nvm use 18', 'npm i --no-frozen-lockfile', 'npx amplify pipeline-deploy --branch $AWS_BRANCH --app-id $AWS_APP_ID']
        frontend:
            phases:
                preBuild:
                    commands: ['npx pnpm install']
                build:
                    commands: ['npx turbo run build --filter=webapp']
            artifacts:
                baseDirectory: apps/webapp/.next
                files:
                    - '**/*'
            cache:
                paths:
                    - 'node_modules/**/*'
            buildPath: /
        appRoot: apps/webapp

what am I doing wrong?

#

Next.js app with no distDir specified (.next is default)

#

even specifying a distDir yields same results

worthy adder
#

@leaden geyser - you able to look?

silent karma
#

also, not sure if it makes a difference, but I changed the "npm ci" command to "npm i --no-frozen-lockfile" because pnpm was complaining about the package.json of my nextapp package being out of sync with the root project's package-lock.json. otherwise this is the amplify.yml generated by the amplify web console.

spice anvil
#

👋 is this for a pnpm monorepo?

silent karma
#

yes indeed

#

.npmrc is in project root with node-linker = hoisted

spice anvil
#

is this the only frontend app in your monorepo that you want to host?

silent karma
#

yes

spice anvil
#

can you try this?

version: 1
backend:
  phases:
    build:
      commands:
        - nvm use 18
        # enable corepack to autoresolve pnpm https://nodejs.org/api/corepack.html
        - corepack enable
        - pnpm install
        - pnpm amplify pipeline-deploy --branch $AWS_BRANCH --app-id $AWS_APP_ID
  cache:
    paths:
    - $(pnpm store path)
frontend:
  phases:
    build:
      commands: 
        - pnpm turbo run build --filter=webapp
  artifacts:
    baseDirectory: apps/webapp/.next
    files:
      - '**/*'
  cache:
    paths:
    - '**/.turbo'
silent karma
#

building now

spice anvil
silent karma
#

!!! CustomerError: Monorepo spec provided without "applications" key

silent karma
spice anvil
spice anvil
silent karma
#

should i be using pnpm deploy here?

spice anvil
#

just updated that yaml for caching the turbo builds

spice anvil
#

with pnpm deploy you won't need to worry about hoisting deps because it'll build to a single directory

modern gale
silent karma
spice anvil
silent karma
#

i figured

spice anvil
modern gale
spice anvil
silent karma
#

do i need to remove them?

spice anvil
silent karma
#

ok

silent karma
#
 Amplify Backend not found in /codebuild/output/src659560591/src/v2. Amplify Backend must be defined in amplify/backend.(ts|js|cjs|mjs)
#

apps/webapp is a app router next app with /amplify directory bootstrapped with gen 2

#

i believe the error would be different if the /amplify folder couldnt be found correct? i remember seeing an error associated with amplify project not found or something along those lines.

somber pecan
#

That repo sample is nice, thanks @spice anvil. What would be the difference with two frontend apps?

spice anvil
spice anvil
somber pecan
spice anvil
somber pecan
#

Well, I imagine I would need to use the Amplify App name

silent karma
#

:///

#

nevermind

#

i forgot to push my next.config with updated distDir. had a mini heart attack lol

silent karma
#

im deployed with no errors, though the domain in amplify console is returning a 404

silent karma
#

sorry for late ping @spice anvil, im getting 404 because platform is being configured for "WEB". how do I change the platform / specify it during build?

spice anvil
#
aws amplify update-app --app-id <your-app-id> --platform WEB_COMPUTE
silent karma
silent karma
#

was because of aws prefixing the command. i am now getting permissions errors on aws.
An error occurred (AccessDeniedException) when calling the UpdateApp operation: User: ...... is not authorized to perform: amplify:UpdateApp on resource <Amplify_ARN>

#

I think im going to just use SST / OpenNext. I cant really afford to spend any more time figuring this out, plus i would probably have another couple of days of debugging to do to get another dev up to speed. Ill revisit when things are a bit further along. Thanks for the assistance @spice anvil you've been amazing.

spice anvil
idle krakenBOT
#

✅ - Artifact directory doesn't exist