月: 2020年3月

  • FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed – JavaScript heap out of memory

    FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed – JavaScript heap out of memory

    はじめに

    redash v8 のリポジトリを clone して コンテナを build しようとすると、

    ` FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed – JavaScript heap out of memory `

    というエラーになった。

    FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
    
    Writing Node.js report to file: report.20200305.111353.33.0.001.json
    Node.js report completed
     1: 0x9dab70 node::Abort() [node]
     2: 0x9dbd26 node::OnFatalError(char const*, char const*) [node]
     3: 0xb3b18e v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node]
     4: 0xb3b509 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node]
     5: 0xce68a5  [node]
     6: 0xce6f36 v8::internal::Heap::RecomputeLimits(v8::internal::GarbageCollector) [node]
     7: 0xcf2dca v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [node]
     8: 0xcf3cd5 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]
     9: 0xcf66e8 v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationType, v8::internal::AllocationAlignment) [node]
    10: 0xcbd017 v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType) [node]
    11: 0xff307b v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [node]
    12: 0x1376259  [node]
    Aborted (core dumped)
    npm ERR! code ELIFECYCLE
    npm ERR! errno 134
    npm ERR! redash-client@9.0.0-alpha build: `npm run clean && NODE_ENV=production webpack`
    npm ERR! Exit status 134
    npm ERR! 
    npm ERR! Failed at the redash-client@9.0.0-alpha build script.
    npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
    ERROR: Service 'server' failed to build: The command '/bin/sh -c npm run build' returned a non-zero code: 134

    原因

    マシンのメモリーが足りない。

    https://redash.io/help/open-source/dev-guide/docker

    v8 のイメージをbuild するには最低限 4G のメモリーが必須となるようだ。

    ビルドするマシンのメモリーを増やすことによって解決できた。

     

     

     

  • ERROR: (gcloud.auth.application-default.print-access-token) The Application Default Credentials are not available.

    ERROR: (gcloud.auth.application-default.print-access-token) The Application Default Credentials are not available.

    はじめに

    gcloud コマンドで key を取得しようとした際、The Application Default Credentials are not available.と出た時の対処法についてまとめます。

    原因と対処

    default のkeyが読み込めていないことが濃厚です。
    対処法としては、環境変数でgcp の key の場所を定義するだけでパスすることができます。

    詳細

    % curl -X POST \
    -H "Authorization: Bearer "$(gcloud auth application-default print-access-token) \
    -H "Content-Type: application/json; charset=utf-8" \
    -d @request.json \
    https://translation.googleapis.com/language/translate/v2
    ERROR: (gcloud.auth.application-default.print-access-token) The Application Default Credentials are not available. They are available if running in Google Compute Engine. Otherwise, the environment variable GOOGLE_APPLICATION_CREDENTIALS must be defined pointing to a file defining the credentials. See https://developers.google.com/accounts/docs/application-default-credentials for more information.
    {
      "error": {
        "code": 403,
        "message": "The request is missing a valid API key.",
        "errors": [
          {
            "message": "The request is missing a valid API key.",
            "domain": "global",
            "reason": "forbidden"
          }
        ],
        "status": "PERMISSION_DENIED"
      }
    }

    `gcloud auth application-default print-access-token`  がうまく動いていないようですね。

    gcloud auth application-default print-access-token

    ERROR: (gcloud.auth.application-default.print-access-token) The Application Default Credentials are not available. They are available if running in Google Compute Engine. Otherwise, the environment variable GOOGLE_APPLICATION_CREDENTIALS must be defined pointing to a file defining the credentials. See https://developers.google.com/accounts/docs/application-default-credentials for more information.

    環境変数 `GOOGLE_APPLICATION_CREDENTIALS` に gcp の key を登録します。

    export GOOGLE_APPLICATION_CREDENTIALS=~/.ssh/gcp.json

     再度 `gcloud auth application-default print-access-token` を叩くとtoken を取得することができます。