question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Feedback] error when using headless init

See original GitHub issue

Page: /cli/usage/headless

Feedback:

I get this feedback in the CLI after attempting to use the headless init described on this page.

Note: It is recommended to run this command from the root of your app directory

For more information on AWS Profiles, see:
https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html

⠧ Initializing your environment: dev(node:89636) UnhandledPromiseRejectionWarning: Error: connect EPERM 52.218.204.177:443 - Local (0.0.0.0:0)
    at internalConnect (net.js:921:16)
    at defaultTriggerAsyncIdScope (internal/async_hooks.js:296:12)
    at GetAddrInfoReqWrap.emitLookup [as callback] (net.js:1063:9)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:69:10)
(node:89636) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:89636) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
⠋ Initializing your environment: dev

The last line shows a spinner infinitely. Initializing your environment: dev

Here is my script to initialize amplify.

#!/bin/bash
set -e
IFS='|'

# required
AMPAPPID="${1}"

# dev,qa,prod
AMPENV="${2:-dev}"

# Headless Init resources:
# https://docs.amplify.aws/cli/usage/headless

AWSCLOUDFORMATIONCONFIG="{\
\"configLevel\":\"project\",\
\"useProfile\":false,\
\"profileName\":\"default\",\
\"accessKeyId\":\"$AWS_ACCESS_KEY_ID\",\
\"secretAccessKey\":\"$AWS_SECRET_ACCESS_KEY\",\
\"region\":\"$AWS_REGION\"\
}"

AMPLIFY="{\
\"appId\":\"$AMPAPPID\",
\"projectName\":\"l12n\",\
\"envName\":\"$AMPENV\",\
\"defaultEditor\":\"code\"\
}"

REACTCONFIG="{\
\"SourceDir\":\"src\",\
\"DistributionDir\":\"build\",\
\"BuildCommand\":\"npm run-script build\",\
\"StartCommand\":\"npm run-script start\"\
}"

FRONTEND="{\
\"frontend\":\"javascript\",\
\"framework\":\"react\",\
\"config\":$REACTCONFIG\
}"

PROVIDERS="{\
\"awscloudformation\":$AWSCLOUDFORMATIONCONFIG\
}"

amplify init \
--amplify $AMPLIFY \
--frontend $FRONTEND \
--providers $PROVIDERS \
--yes

My goal is to run the script above on a Jenkins server. For now, I invoke the script above on my local terminal like this, from package.json

  "scripts": {
    "server": "amplify mock",
    "amplify-init-dev": "AWS_ACCESS_KEY_ID=$(aws configure get aws_access_key_id) AWS_SECRET_ACCESS_KEY=$(aws configure get aws_secret_access_key) AWS_REGION=$(aws configure get region) ./amplify-init-cicd.sh OMITTED dev",
    "amplify-init-qa": "AWS_ACCESS_KEY_ID=$(aws configure get aws_access_key_id) AWS_SECRET_ACCESS_KEY=$(aws configure get aws_secret_access_key) AWS_REGION=$(aws configure get region) ./amplify-init-cicd.sh OMITTED qa",
    "amplify-init-prod": "AWS_ACCESS_KEY_ID=$(aws configure get aws_access_key_id) AWS_SECRET_ACCESS_KEY=$(aws configure get aws_secret_access_key) AWS_REGION=$(aws configure get region) ./amplify-init-cicd.sh OMITTED prod",
  }

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
cyrfercommented, Mar 7, 2021

I think the issue was my local environment. I have not attempted this since the initial post. However, many other errors stopped happening when I upgraded my local to newer than node 12. I might revisit this soon.

0reactions
github-actions[bot]commented, May 25, 2021

This issue has been automatically locked since there hasn’t been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels for those types of questions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ElementNotInteractableException error when using headless ...
Show activity on this post. I get error when i try and run say below code. This seems to be happening because of...
Read more >
amplify import auth causes build failure - auth headless init is ...
I committed my code to git and pushed, which kicked off an Amplify Console pipeline, the build of the backend failed with the...
Read more >
993686 - Problem with Chrome headless from CLI: empty PDF ...
Issue 993686: Problem with Chrome headless from CLI: empty PDF and error “Failed to serialize document: Uncaught”.
Read more >
Feedback - Headless Mode Isn't Really Headless - Unity Forum
I'm trying to use the Hub in a docker container. Here is the image Dockerfile: FROM ubuntu:16.04 WORKDIR /tmp COPY UnityHub.AppImage .
Read more >
Issue running openGL via headless mac mini - Apple Developer
I am currently trying to use EC2 mac instances to run a CI/CD pipeline which involves running tests with electron/selenium.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found