aws-amplify / amplify-cli

The AWS Amplify CLI is a toolchain for simplifying serverless web and mobile development.
Apache License 2.0
2.82k stars 820 forks source link

amplify v8 not working on alpine docker images #10295

Open jjrdevspace01 opened 2 years ago

jjrdevspace01 commented 2 years ago

Before opening, please confirm:

How did you install the Amplify CLI?

npm install -g @aws-amplify/cli --unsafe-perm=true

If applicable, what version of Node.js are you using?

14

Amplify CLI Version

no output

What operating system are you using?

alpine

Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.

no

Amplify Categories

Not applicable

Amplify Commands

configure

Describe the bug

amplify cli@8 produces no output or functionality

Expected behavior

amplify cli@8 works the same as @7 after installation

Reproduction steps

  1. docker run -it node:14-alpine sh
  2. npm install -g @aws-amplify/cli --unsafe-perm=true
  3. amplify --version

GraphQL schema(s)

```graphql # Put schemas below this line ```

Log output

``` # Put your logs below this line ```

Additional information

No response

josefaidt commented 2 years ago

Hey @jjrdevspace01 :wave: thanks for raising this! I was able to confirm this behavior using the provided steps. Marking as a bug 🙂

> docker run -it node:14-alpine sh
/ # npm i -g @aws-amplify/cli --unsafe-perm=true
/usr/local/bin/amplify -> /usr/local/lib/node_modules/@aws-amplify/cli/lib/run.js

> @aws-amplify/cli@8.0.2 postinstall /usr/local/lib/node_modules/@aws-amplify/cli
> node ./lib/install.js || echo "failed to install amplify binary"

Downloading release from https://d2bkhsss993doa.cloudfront.net/8.0.2/amplify-pkg-linux-arm64.tgz
amplify has been installed!
+ @aws-amplify/cli@8.0.2
added 26 packages from 16 contributors in 12.985s
/ # amplify version
/ # amplify init
/ # amplify configure
/ # 
johnpc commented 2 years ago

Interesting. I'm seeing several errors when I try to run the compiled binary directly on that docker image:

~/.amplify/bin # /root/.amplify/bin/amplify --version
Error loading shared library ld-linux-x86-64.so.2: No such file or directory (needed by /root/.amplify/bin/amplify)
Error relocating /root/.amplify/bin/amplify: gnu_get_libc_version: symbol not found
Error relocating /root/.amplify/bin/amplify: __register_atfork: symbol not found
Error relocating /root/.amplify/bin/amplify: __strdup: symbol not found
Error relocating /root/.amplify/bin/amplify: setcontext: symbol not found
Error relocating /root/.amplify/bin/amplify: makecontext: symbol not found
Error relocating /root/.amplify/bin/amplify: backtrace: symbol not found
Error relocating /root/.amplify/bin/amplify: getcontext: symbol not found
Error relocating /root/.amplify/bin/amplify: __libc_stack_end: symbol not found

It looks like in order to execute our binary, more system dependencies are required.

johnpc commented 2 years ago

As a short term workaround, you can either continue using v7 or install v8 via npm i -g @aws-amplify/cli-internal. I don't generally recommend using the internal package, but it does happen to work in alpine docker.

George-Kibe commented 2 years ago

Amplify cli not working. What could be the reason? I have tried to look for solutions online unsuccessfully.

Here is the error

Platform with type "Windows_NT" and architecture "ia32" is not supported by @aws-amplify/cli.}

ebo7 commented 2 years ago

Having same issue, is there update on this issue?

sergiorodriguez82 commented 2 years ago

HI, trying to create a CI/CD docker image with alpine... Any new regarding this issue? amplify 7 is now too old...

when creating a pull script this error happends with the internal cli..

Failed to pull the backend. (node:509) [DEP0128] DeprecationWarning: Invalid 'main' field in '/usr/local/lib/node_modules/@aws-amplify/cli-internal/node_modules/cloudform/package.json' of 'packages/cloudform/index.js'. Please either fix that or report it to the module author 🛑 Cannot find module '@aws-amplify/datastore' Require stack:

Any ideas?

jparksecurity commented 2 years ago

@josefaidt @johnpc

Could you share the timeline to fix this issue? Or will it be fixed at all?

It still happens with amplify cli v10.2.3

jparksecurity commented 2 years ago

HI, trying to create a CI/CD docker image with alpine... Any new regarding this issue? amplify 7 is now too old...

when creating a pull script this error happends with the internal cli..

Failed to pull the backend. (node:509) [DEP0128] DeprecationWarning: Invalid 'main' field in '/usr/local/lib/node_modules/@aws-amplify/cli-internal/node_modules/cloudform/package.json' of 'packages/cloudform/index.js'. Please either fix that or report it to the module author 🛑 Cannot find module '@aws-amplify/datastore' Require stack:

  • /usr/local/lib/node_modules/@aws-amplify/cli-internal/node_modules/@aws-amplify/codegen-ui/dist/lib/types/data.js
  • /usr/local/lib/node_modules/@aws-amplify/cli-internal/node_modules/@aws-amplify/codegen-ui/dist/lib/types/index.js
  • /usr/local/lib/node_modules/@aws-amplify/cli-internal/node_modules/@aws-amplify/codegen-ui/dist/lib/generate-form-definition/helpers/form-field.js
  • /usr/local/lib/node_modules/@aws-amplify/cli-internal/node_modules/@aws-amplify/codegen-ui/dist/lib/generate-form-definition/helpers/index.js
  • /usr/local/lib/node_modules/@aws-amplify/cli-internal/node_modules/@aws-amplify/codegen-ui/dist/lib/generate-form-definition/index.js
  • /usr/local/lib/node_modules/@aws-amplify/cli-internal/node_modules/@aws-amplify/codegen-ui/dist/index.js
  • /usr/local/lib/node_modules/@aws-amplify/cli-internal/node_modules/@aws-amplify/amplify-util-uibuilder/lib/commands/utils/codegenResources.js
  • /usr/local/lib/node_modules/@aws-amplify/cli-internal/node_modules/@aws-amplify/amplify-util-uibuilder/lib/commands/utils/index.js
  • /usr/local/lib/node_modules/@aws-amplify/cli-internal/node_modules/@aws-amplify/amplify-util-uibuilder/lib/commands/generateComponents.js
  • /usr/local/lib/node_modules/@aws-amplify/cli-internal/node_modules/@aws-amplify/amplify-util-uibuilder/lib/index.js
  • /usr/local/lib/node_modules/@aws-amplify/cli-internal/lib/extensions/amplify-helpers/invoke-plugin-method.js
  • /usr/local/lib/node_modules/@aws-amplify/cli-internal/lib/domain/amplify-toolkit.js
  • /usr/local/lib/node_modules/@aws-amplify/cli-internal/lib/domain/context.js
  • /usr/local/lib/node_modules/@aws-amplify/cli-internal/lib/context-manager.js
  • /usr/local/lib/node_modules/@aws-amplify/cli-internal/lib/index.js
  • /usr/local/lib/node_modules/@aws-amplify/cli-internal/bin/amplify

Any ideas?

I was able to fix it by installing the package.

npm install -g @aws-amplify/datastore

I recommend following johnpc's advice, using cli-internal.

jparksecurity commented 2 years ago

Tag https://github.com/vercel/pkg/issues/1564

dobeerman commented 1 year ago

March 2023. Any updates so far? :wink: