nteract / commuter

🚎 Notebook sharing hub

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How is assume role working in commuter?

yummydum opened this issue · comments

Hi, I have problem in s3 backend with assume role.
Currently, I run commuter by the following command;

git clone git@github.com:nteract/commuter.git
cd commuter 
yarn
COMMUTER_S3_ENDPOINT=s3.ap-northeast-1.amazonaws.com COMMUTER_BUCKET=<my_bucket> COMMUTER_STORAGE_BACKEND=s3 yarn dev

The compile succeeds and I get

yarn run v1.21.1
$ npm run build:server
npm WARN lifecycle The node binary used for scripts is /var/folders/c0/rvxcyrm51z395rcx_lg444l00000gn/T/yarn--1578311114367-0.26080746994808/node but npm is using /usr/local/Cellar/node/13.5.0/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.

> @nteract/commuter@5.8.0 build:server /Users/myname/dev_home/commuter
> babel backend -d lib

Browserslist: caniuse-lite is outdated. Please run next command `yarn upgrade`
Successfully compiled 21 files with Babel.
$ NODE_ENV=development node lib/index.js
CONFIGURED DISCOVERY none
Browserslist: caniuse-lite is outdated. Please run next command `yarn upgrade`
> Using external babel configuration
> Location: "/Users/myname/dev_home/commuter/babel.config.js"
[ ready ] compiled successfully
[ wait ]  compiling ...
[Function: self] { level: 'info', levelIndex: 3, levelRoot: [Circular] }
[ ready ] compiled successfully

However, when I access to localhost:4000, the following log occurs;

[ event ] build page: /view
[ wait ]  compiling ...
[ ready ] compiled successfully
[ event ] disposing inactive page(s): /view
::ffff:127.0.0.1 - - [06/Jan/2020:11:59:04 +0000] "GET /api/contents// HTTP/1.1" 500 73
::1 - - [06/Jan/2020:11:59:04 +0000] "GET /view/ HTTP/1.1" 200 3080
[ event ] build page: /view
[ wait ]  compiling ...
::1 - - [06/Jan/2020:11:59:04 +0000] "GET /_next/static/development/pages/_app.js?ts=1578311944366 HTTP/1.1" 200 325674
::1 - - [06/Jan/2020:11:59:04 +0000] "GET /static/nprogress.css HTTP/1.1" 304 -
::1 - - [06/Jan/2020:11:59:04 +0000] "GET /static/commuter.css HTTP/1.1" 304 -
::1 - - [06/Jan/2020:11:59:04 +0000] "GET /_next/static/runtime/webpack.js?ts=1578311944366 HTTP/1.1" 200 34770
::1 - - [06/Jan/2020:11:59:05 +0000] "GET /_next/static/runtime/main.js?ts=1578311944366 HTTP/1.1" 200 851627
::1 - - [06/Jan/2020:11:59:05 +0000] "GET /_next/static/development/dll/dll_0b0bc16446b9b5ad32e8.js?ts=1578311944366 HTTP/1.1" 200 901660
::1 - - [06/Jan/2020:11:59:06 +0000] "GET /_next/static/chunks/0.js HTTP/1.1" 200 440
[ ready ] compiled successfully
::1 - - [06/Jan/2020:11:59:08 +0000] "GET /_next/static/development/pages/view.js?ts=1578311944366 HTTP/1.1" 200 11642259
::1 - - [06/Jan/2020:11:59:08 +0000] "GET /static/favicon.ico HTTP/1.1" 200 15086
::1 - - [06/Jan/2020:11:59:08 +0000] "GET /_next/static/runtime/main.js?ts=1578311944366 HTTP/1.1" 200 851627
::1 - - [06/Jan/2020:11:59:08 +0000] "GET /_next/static/runtime/main.js.map HTTP/1.1" 200 764921
::1 - - [06/Jan/2020:12:00:51 +0000] "GET /_next/webpack-hmr?page=/view HTTP/1.1" 200 -
::1 - - [06/Jan/2020:12:00:51 +0000] "GET /_next/static/webpack/a14bf379b2252fc7a9c8.hot-update.json HTTP/1.1" 200 35
::1 - - [06/Jan/2020:12:01:48 +0000] "GET /_next/webpack-hmr?page=/view HTTP/1.1" 200 -
::ffff:127.0.0.1 - - [06/Jan/2020:12:02:06 +0000] "GET /api/contents// HTTP/1.1" 500 73
::1 - - [06/Jan/2020:12:02:06 +0000] "GET /view/ HTTP/1.1" 200 3080
::1 - - [06/Jan/2020:12:02:06 +0000] "GET /_next/webpack-hmr?page=/view HTTP/1.1" 200 -
::1 - - [06/Jan/2020:12:02:06 +0000] "GET /static/nprogress.css HTTP/1.1" 304 -
::1 - - [06/Jan/2020:12:02:06 +0000] "GET /_next/static/runtime/webpack.js?ts=1578312126707 HTTP/1.1" 200 34770
::1 - - [06/Jan/2020:12:02:06 +0000] "GET /static/commuter.css HTTP/1.1" 304 -
::1 - - [06/Jan/2020:12:02:06 +0000] "GET /_next/static/development/pages/_app.js?ts=1578312126707 HTTP/1.1" 200 325674
::1 - - [06/Jan/2020:12:02:06 +0000] "GET /_next/static/runtime/main.js?ts=1578312126707 HTTP/1.1" 200 851627
::1 - - [06/Jan/2020:12:02:06 +0000] "GET /_next/static/development/dll/dll_0b0bc16446b9b5ad32e8.js?ts=1578312126707 HTTP/1.1" 200 901660
::1 - - [06/Jan/2020:12:02:06 +0000] "GET /_next/static/chunks/0.js HTTP/1.1" 200 440
::1 - - [06/Jan/2020:12:02:07 +0000] "GET /_next/static/development/pages/view.js?ts=1578312126707 HTTP/1.1" 200 11642259
::1 - - [06/Jan/2020:12:02:07 +0000] "GET /_next/static/runtime/main.js?ts=1578312126707 HTTP/1.1" 200 851627
::1 - - [06/Jan/2020:12:02:07 +0000] "GET /_next/static/runtime/main.js.map HTTP/1.1" 200 764921

If I run in production mode,
I get an different error message.

::ffff:127.0.0.1 - - [06/Jan/2020:12:09:10 +0000] "GET /api/contents// HTTP/1.1" 500 73
[Error [AjaxError]: ajax error 500] {
  message: 'ajax error 500',
  name: 'AjaxError',
  xhr: {
    UNSENT: 0,
    OPENED: 1,
    HEADERS_RECEIVED: 2,
    LOADING: 3,
    DONE: 4,
    readyState: 4,
    onreadystatechange: [Function: xhrReadyStateChange] {
      subscriber: [AjaxSubscriber],
      progressSubscriber: undefined,
      request: [Object]
    },
    responseText: '{"message":"Missing credentials in config: ","reason":"CredentialsError"}',
    responseXML: '',
    status: 500,
    statusText: null,
    withCredentials: false,
    open: [Function],
    setDisableHeaderCheck: [Function],
    setRequestHeader: [Function],
    getResponseHeader: [Function],
    getAllResponseHeaders: [Function],
    getRequestHeader: [Function],
    send: [Function],
    handleError: [Function],
    abort: [Function],
    addEventListener: [Function],
    removeEventListener: [Function],
    dispatchEvent: [Function],
    ontimeout: [Function: xhrTimeout] {
      request: [Object],
      subscriber: [AjaxSubscriber],
      progressSubscriber: undefined
    },
    onload: [Function: xhrLoad] {
      subscriber: [AjaxSubscriber],
      progressSubscriber: undefined,
      request: [Object]
    },
    timeout: 0,
    responseType: 'json'
  },
  request: {
    async: true,
    createXHR: [Function: createXHR],
    crossDomain: true,
    withCredentials: false,
    headers: {},
    method: 'GET',
    responseType: 'json',
    timeout: 0,
    url: 'http://127.0.0.1:4000/api/contents//',
    body: undefined
  },
  status: 500,
  responseType: 'json',
  response: {
    message: 'Missing credentials in config: ',
    reason: 'CredentialsError'
  }
}

My ~/.aws/config is structured as follows

[default]
source_profile = foo 
role_arn = arn:aws:iam::000000000000:role/my-role
region = ap-northeast-1
output = json

~/.aws/credentials as follows

[foo]
aws_access_key_id = XXXXXXXXXXXXXX
aws_secret_access_key = XXXXXXXXXXXX

And I can successfully run aws s3 ls.
Any suggestions?
Thank you for your help in advance :)

@yummydum We are facing this issue too. Did you resolve it?

I don't believe that we have explicit support for roles in the S3 provider for commuter.

Our S3 provider is located here.