strapi / strapi

🚀 Strapi is the leading open-source headless CMS. It’s 100% JavaScript/TypeScript, fully customizable, and developer-first.
https://strapi.io
Other
63.97k stars 8.15k forks source link

createTelemetry crashes on none-shell host #8893

Closed hxhieu closed 2 years ago

hxhieu commented 3 years ago

Bug report

Describe the bug

When hosting Strapi on a none-shell host such as Google distroless container, the start up script will crash because node-machine is executing a shell script to get the machine ID.

Steps to reproduce the behavior

Like above

Expected behavior

Not crashing

Screenshots

If applicable, add screenshots to help explain your problem.

Code snippets

If applicable, add code samples to help explain your problem.

System

Additional context

According to this https://strapi.io/documentation/v3.x/getting-started/usage-information.html#commitment-to-our-users-data-collection, we can opt-out the telemetry but even that the code still try to execute node-machine get ID. It should stop doing that if the consumer has chosen to opt-out

// lib/sevices/metrics/sender/js line 25

let deviceId = 'unknown'
// machineIdSync() will not work on none-shell host
// so we should disable it when opt-out telemetry
// https://strapi.io/documentation/v3.x/getting-started/usage-information.html#commitment-to-our-users-data-collection
if (uuid){
    deviceId = machineIdSync();
}
derrickmehaffy commented 3 years ago

This issue has been mentioned on Strapi Community Forum. There might be relevant details there:

https://forum.strapi.io/t/strapi-deployment-in-aws-amplify/1642/9

hxhieu commented 3 years ago

Thanks @derrickmehaffy

kicaal commented 3 years ago

hello! Is there any solution? i have delete uuid from package json and the /bin/sh: hostname: command not found it continues to appear in the amplify deploy… is there any other way? thanks!!

version: 1
backend:
  phases:
    preBuild:
      commands:
        - cd cms
        - npm install
    build:
      commands:
        - npm run build
    postBuild:
        commands:
        - npm run start
  artifacts:
    baseDirectory: build
    files:
      - '**/*'
  cache:
    paths:
      - node_modules/**/*
frdrk commented 3 years ago

Is there a working solution or planned workaround for this issue? Currently looking at getting Strapi up and running on AWS Amplify.

justyn-clark commented 2 years ago

Also looking for this issue to be fixed or a workaround ASAP. I'm getting the same exact error when trying to build Strapi in Amplify.

/bin/sh: hostname: command not found

I would really really like to build both Strapi front and back end in Amplify.

derrickmehaffy commented 2 years ago

Also looking for this issue to be fixed or a workaround ASAP. I'm getting the same exact error when trying to build Strapi in Amplify.

/bin/sh: hostname: command not found

I would really really like to build both Strapi front and back end in Amplify.

you can use patch-package to apply the fix in https://github.com/strapi/strapi/pull/12173/files until we get time to review/merge

crocco95 commented 2 years ago

Is there a date for when this fix will be in production as npm package without patch trick?

derrickmehaffy commented 2 years ago

Is there a date for when this fix will be in production as npm package without patch trick?

We merged and fixed this back in v4.0.5

Cardoso222 commented 3 months ago

The problem persists, I'm facing the same issue as @kicaal and I'm using strapi version 4.25.7

justyn-clark commented 3 months ago

The problem persists, I'm facing the same issue as @kicaal and I'm using strapi version 4.25.7

I recommend using Strapi on Railway.app

Cardoso222 commented 3 months ago

@justyn-clark I created a tutorial explaining how to deploy using AWS Elastic Beanstalk. it may be helpful https://medium.com/@paulo16061/how-to-set-up-strapi-on-aws-elastic-beanstalk-e9b9fa0520b7

justyn-clark commented 3 months ago

@justyn-clark I created a tutorial explaining how to deploy using AWS Elastic Beanstalk. it may be helpful https://medium.com/@paulo16061/how-to-set-up-strapi-on-aws-elastic-beanstalk-e9b9fa0520b7

Nice! Thanks for sharing.