You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "mdevale (via GitHub)" <gi...@apache.org> on 2024/05/20 12:56:08 UTC
Re: [I] 500 'Fatal error' When Creating Dashboard Through Public API [superset]
mdevale commented on issue #22704:
URL: https://github.com/apache/superset/issues/22704#issuecomment-2120409277
> Working as Expected.Created a dashboard
>
> Screenshots:-  
>
> test.js:- const axios = require('axios') const SUPERSET_HOST = 'http://localhost:9000'
>
> async function createDashboard() { try { const result = await axios({ url: `${SUPERSET_HOST}/api/v1/dashboard/`, data: { dashboard_title: 'New Dashboard1' }, headers: { Authorization: 'Bearer ' + await getAuthToken() }, method: 'post' });
>
> ```
> console.log(result);
> } catch (err) {
> console.log(err.response.status);
> console.log(err.response.data);
> }
> ```
>
> }
>
> async function getAuthToken() { const result = await axios({ url: `${SUPERSET_HOST}/api/v1/security/login`, data: { "username": 'admin', "password": 'admin', "provider": "db", "refresh": true }, method: 'post' });
>
> ```
> return result?.data?.access_token;
> ```
>
> } createDashboard()
>
> Output:-
>
> [Running] node "/home/shali/AS_202/test.js" { status: 201, statusText: 'CREATED', headers: AxiosHeaders { 'x-powered-by': 'Express', server: 'Werkzeug/2.1.2 Python/3.8.10', date: 'Thu, 20 Apr 2023 07:53:05 GMT', 'content-type': 'application/json; charset=utf-8', 'content-length': '75', vary: 'Accept-Encoding', connection: 'close' }, config: { transitional: { silentJSONParsing: true, forcedJSONParsing: true, clarifyTimeoutError: false }, adapter: [ 'xhr', 'http' ], transformRequest: [ [Function: transformRequest] ], transformResponse: [ [Function: transformResponse] ], timeout: 0, xsrfCookieName: 'XSRF-TOKEN', xsrfHeaderName: 'X-XSRF-TOKEN', maxContentLength: -1, maxBodyLength: -1, env: { FormData: [Function], Blob: null }, validateStatus: [Function: validateStatus], headers: AxiosHeaders { Accept: 'application/json, text/plain, _/_', 'Content-Type': 'application/json', Authorization: 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJmcmVzaCI6dHJ1ZSwiaWF0IjoxNjgxOTc3MTg1LCJqdGkiOiI
2N2QyOWY4ZC04YTI2LTQ1ZWMtYjUzZS1jZjI4Y2JiOGJkYTkiLCJ0eXBlIjoiYWNjZXNzIiwic3ViIjoxLCJuYmYiOjE2ODE5NzcxODUsImV4cCI6MTY4MTk3ODA4NX0.G-gW5rdzNmpGUp3FW29WPRV-42gN8z2G9OvCvni2DmQ', 'User-Agent': 'axios/1.3.6', 'Content-Length': '36', 'Accept-Encoding': 'gzip, compress, deflate, br' }, url: 'http://localhost:9000/api/v1/dashboard/', data: '{"dashboard_title":"New Dashboard1"}', method: 'post' }, request: <ref *1> ClientRequest { _events: [Object: null prototype] { abort: [Function (anonymous)], aborted: [Function (anonymous)], connect: [Function (anonymous)], error: [Function (anonymous)], socket: [Function (anonymous)], timeout: [Function (anonymous)], finish: [Function: requestOnFinish] }, _eventsCount: 7, _maxListeners: undefined, outputData: [], outputSize: 0, writable: true, destroyed: false, _last: true, chunkedEncoding: false, shouldKeepAlive: false, maxRequestsOnConnectionReached: false, _defaultKeepAlive: true, useChunkedEncodingByDefault: true, sendDate: false, _removedConnection
: false, _removedContLen: false, _removedTE: false, strictContentLength: false, _contentLength: '36', _hasBody: true, _trailer: '', finished: true, _headerSent: true, _closed: false, socket: Socket { connecting: false, _hadError: false, _parent: null, _host: 'localhost', _closeAfterHandlingError: false, _readableState: [ReadableState], _events: [Object: null prototype], _eventsCount: 7, _maxListeners: undefined, _writableState: [WritableState], allowHalfOpen: false, _sockname: null, _pendingData: null, _pendingEncoding: '', server: null, _server: null, parser: null, _httpMessage: [Circular *1], [Symbol(async_id_symbol)]: 29, [Symbol(kHandle)]: [TCP], [Symbol(lastWriteQueueSize)]: 0, [Symbol(timeout)]: null, [Symbol(kBuffer)]: null, [Symbol(kBufferCb)]: null, [Symbol(kBufferGen)]: null, [Symbol(kCapture)]: false, [Symbol(kSetNoDelay)]: false, [Symbol(kSetKeepAlive)]: true, [Symbol(kSetKeepAliveInitialDelay)]: 60, [Symbol(kBytesRead)]: 0, [Symbol(kBytesWritten)]: 0, [Symbol(RequestTim
eout)]: undefined }, _header: 'POST /api/v1/dashboard/ HTTP/1.1\r\n' + 'Accept: application/json, text/plain, _/_\r\n' + 'Content-Type: application/json\r\n' + 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJmcmVzaCI6dHJ1ZSwiaWF0IjoxNjgxOTc3MTg1LCJqdGkiOiI2N2QyOWY4ZC04YTI2LTQ1ZWMtYjUzZS1jZjI4Y2JiOGJkYTkiLCJ0eXBlIjoiYWNjZXNzIiwic3ViIjoxLCJuYmYiOjE2ODE5NzcxODUsImV4cCI6MTY4MTk3ODA4NX0.G-gW5rdzNmpGUp3FW29WPRV-42gN8z2G9OvCvni2DmQ\r\n' + 'User-Agent: axios/1.3.6\r\n' + 'Content-Length: 36\r\n' + 'Accept-Encoding: gzip, compress, deflate, br\r\n' + 'Host: localhost:9000\r\n' + 'Connection: close\r\n' + '\r\n', _keepAliveTimeout: 0, _onPendingData: [Function: nop], agent: Agent { _events: [Object: null prototype], _eventsCount: 2, _maxListeners: undefined, defaultPort: 80, protocol: 'http:', options: [Object: null prototype], requests: [Object: null prototype] {}, sockets: [Object: null prototype], freeSockets: [Object: null prototype] {}, keepAliveMsecs: 1000, keepAlive: fal
se, maxSockets: Infinity, maxFreeSockets: 256, scheduling: 'lifo', maxTotalSockets: Infinity, totalSocketCount: 1, [Symbol(kCapture)]: false }, socketPath: undefined, method: 'POST', maxHeaderSize: undefined, insecureHTTPParser: undefined, path: '/api/v1/dashboard/', _ended: true, res: IncomingMessage { _readableState: [ReadableState], _events: [Object: null prototype], _eventsCount: 4, _maxListeners: undefined, socket: [Socket], httpVersionMajor: 1, httpVersionMinor: 1, httpVersion: '1.1', complete: true, rawHeaders: [Array], rawTrailers: [], aborted: false, upgrade: false, url: '', method: null, statusCode: 201, statusMessage: 'CREATED', client: [Socket], _consuming: true, _dumped: false, req: [Circular *1], responseUrl: 'http://localhost:9000/api/v1/dashboard/', redirects: [], [Symbol(kCapture)]: false, [Symbol(kHeaders)]: [Object], [Symbol(kHeadersCount)]: 14, [Symbol(kTrailers)]: null, [Symbol(kTrailersCount)]: 0, [Symbol(RequestTimeout)]: undefined }, aborted: false, timeoutCb
: null, upgradeOrConnect: false, parser: null, maxHeadersCount: null, reusedSocket: false, host: 'localhost', protocol: 'http:', _redirectable: Writable { _writableState: [WritableState], _events: [Object: null prototype], _eventsCount: 3, _maxListeners: undefined, _options: [Object], _ended: true, _ending: true, _redirectCount: 0, _redirects: [], _requestBodyLength: 36, _requestBodyBuffers: [], _onNativeResponse: [Function (anonymous)], _currentRequest: [Circular *1], _currentUrl: 'http://localhost:9000/api/v1/dashboard/', [Symbol(kCapture)]: false }, [Symbol(kCapture)]: false, [Symbol(kBytesWritten)]: 0, [Symbol(kEndCalled)]: true, [Symbol(kNeedDrain)]: false, [Symbol(corked)]: 0, [Symbol(kOutHeaders)]: [Object: null prototype] { accept: [Array], 'content-type': [Array], authorization: [Array], 'user-agent': [Array], 'content-length': [Array], 'accept-encoding': [Array], host: [Array] }, [Symbol(kUniqueHeaders)]: null }, data: { id: 36, result: { dashboard_title: 'New Dashboard1'
} } }
>
> [Done] exited with code=0 in 0.306 seconds
Did you removed the cookies.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org