diff --git a/.circleci/config.yml b/.circleci/config.yml index e7407c13a..08614999d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -196,8 +196,7 @@ jobs: path: rest-test-results front-end-tests: machine: - image: ubuntu-2004:202010-01 - resource_class: xlarge + image: default steps: - attach_workspace: at: ~/ diff --git a/containers/postgis/Dockerfile b/containers/postgis/Dockerfile index 2d3b9c188..9fca2fc41 100644 --- a/containers/postgis/Dockerfile +++ b/containers/postgis/Dockerfile @@ -6,7 +6,7 @@ RUN sed -i "s;http://archive.ubuntu.com/ubuntu/;${APT_REPO_HOST};" /etc/apt/sour WORKDIR /work RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ - build-essential git ca-certificates postgresql-server-dev-14 cron && rm -rf /var/lib/apt/lists + build-essential git ca-certificates postgresql-server-dev-14 clang-11 llvm-11 cron && rm -rf /var/lib/apt/lists RUN git clone --branch v0.4.4 https://github.com/pgvector/pgvector.git WORKDIR /work/pgvector RUN make diff --git a/scripts/packages/tator-js b/scripts/packages/tator-js index a35088437..cd6cf6ddb 160000 --- a/scripts/packages/tator-js +++ b/scripts/packages/tator-js @@ -1 +1 @@ -Subproject commit a350884379baab8ab309abcf4734cf15fe407f33 +Subproject commit cd6cf6ddb9d0306b39611b34f38231b62441e4b7 diff --git a/scripts/packages/tator-py b/scripts/packages/tator-py index 204e689e9..063fb3857 160000 --- a/scripts/packages/tator-py +++ b/scripts/packages/tator-py @@ -1 +1 @@ -Subproject commit 204e689e9a4e6b58639f8538307f42cbdeb210e6 +Subproject commit 063fb3857f82c407e825f615f258360c3dc53838 diff --git a/test/test_playback.py b/test/test_playback.py index 51c7f9599..27e6f97a5 100644 --- a/test/test_playback.py +++ b/test/test_playback.py @@ -554,7 +554,7 @@ def test_playback_schedule_1fps(page_factory, project, count_1fps_test): page.close() -@pytest.mark.flaky(reruns=2) +@pytest.mark.skip(reason="Too flaky") def test_concat(page_factory, project, concat_test): print("[Video] Going to annotation view...") page = page_factory(f"{os.path.basename(__file__)}__{inspect.stack()[0][3]}") diff --git a/ui/package-lock.json b/ui/package-lock.json index f0957d9f1..3226b7917 100644 --- a/ui/package-lock.json +++ b/ui/package-lock.json @@ -15,14 +15,14 @@ "d3": "7.3.0", "express": "^4.18.2", "express-http-proxy": "^1.6.3", - "fetch-retry": "5.0.3", + "fetch-retry": "5.0.6", "hls.js": "1.2.3", - "isomorphic-fetch": "3.0.0", "js-yaml": "4.1.0", "jszip": "^3.8.0", "libtess": "1.2.0", "marked": "4.0.12", "mp4box": "0.4.9", + "node-fetch": "^2", "nodemon": "^3.0.1", "nunjucks": "^3.2.4", "serve-favicon": "^2.5.0", @@ -1465,9 +1465,9 @@ } }, "node_modules/fetch-retry": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/fetch-retry/-/fetch-retry-5.0.3.tgz", - "integrity": "sha512-uJQyMrX5IJZkhoEUBQ3EjxkeiZkppBd5jS/fMTJmfZxLSiaQjv2zD0kTvuvkSH89uFvgSlB6ueGpjD3HWN7Bxw==" + "version": "5.0.6", + "resolved": "https://registry.npmjs.org/fetch-retry/-/fetch-retry-5.0.6.tgz", + "integrity": "sha512-3yurQZ2hD9VISAhJJP9bpYFNQrHHBXE2JxxjY5aLEcDi46RmAzJE2OC9FAde0yis5ElW0jTTzs0zfg/Cca4XqQ==" }, "node_modules/fill-range": { "version": "7.0.1", @@ -1803,15 +1803,6 @@ "node": ">=0.10.0" } }, - "node_modules/isomorphic-fetch": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/isomorphic-fetch/-/isomorphic-fetch-3.0.0.tgz", - "integrity": "sha512-qvUtwJ3j6qwsF3jLxkZ72qCgjMysPzDfeV240JHiGZsANBYd+EEuu35v7dfrJ9Up0Ak07D7GGSkGhCHTqg/5wA==", - "dependencies": { - "node-fetch": "^2.6.1", - "whatwg-fetch": "^3.4.1" - } - }, "node_modules/jest-worker": { "version": "27.5.1", "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-27.5.1.tgz", @@ -2106,9 +2097,9 @@ "dev": true }, "node_modules/node-fetch": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.9.tgz", - "integrity": "sha512-DJm/CJkZkRjKKj4Zi4BsKVZh3ValV5IR5s7LVZnW+6YMh0W1BfNA8XSs6DLMGYlId5F3KnA70uu2qepcR08Qqg==", + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", "dependencies": { "whatwg-url": "^5.0.0" }, @@ -3318,6 +3309,11 @@ "node": ">=10.13.0" } }, + "node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + }, "node_modules/webpack": { "version": "5.79.0", "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.79.0.tgz", @@ -3492,11 +3488,6 @@ "url": "https://opencollective.com/webpack" } }, - "node_modules/whatwg-fetch": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-3.6.2.tgz", - "integrity": "sha512-bJlen0FcuU/0EMLrdbJ7zOnW6ITZLrZMIarMUVmdKtsGvZna8vxKYaexICWPfZ8qwf9fzNq+UEIZrnSaApt6RA==" - }, "node_modules/whatwg-url": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", @@ -3506,11 +3497,6 @@ "webidl-conversions": "^3.0.0" } }, - "node_modules/whatwg-url/node_modules/webidl-conversions": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" - }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", @@ -4710,9 +4696,9 @@ "dev": true }, "fetch-retry": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/fetch-retry/-/fetch-retry-5.0.3.tgz", - "integrity": "sha512-uJQyMrX5IJZkhoEUBQ3EjxkeiZkppBd5jS/fMTJmfZxLSiaQjv2zD0kTvuvkSH89uFvgSlB6ueGpjD3HWN7Bxw==" + "version": "5.0.6", + "resolved": "https://registry.npmjs.org/fetch-retry/-/fetch-retry-5.0.6.tgz", + "integrity": "sha512-3yurQZ2hD9VISAhJJP9bpYFNQrHHBXE2JxxjY5aLEcDi46RmAzJE2OC9FAde0yis5ElW0jTTzs0zfg/Cca4XqQ==" }, "fill-range": { "version": "7.0.1", @@ -4959,15 +4945,6 @@ "integrity": "sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==", "dev": true }, - "isomorphic-fetch": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/isomorphic-fetch/-/isomorphic-fetch-3.0.0.tgz", - "integrity": "sha512-qvUtwJ3j6qwsF3jLxkZ72qCgjMysPzDfeV240JHiGZsANBYd+EEuu35v7dfrJ9Up0Ak07D7GGSkGhCHTqg/5wA==", - "requires": { - "node-fetch": "^2.6.1", - "whatwg-fetch": "^3.4.1" - } - }, "jest-worker": { "version": "27.5.1", "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-27.5.1.tgz", @@ -5179,9 +5156,9 @@ "dev": true }, "node-fetch": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.9.tgz", - "integrity": "sha512-DJm/CJkZkRjKKj4Zi4BsKVZh3ValV5IR5s7LVZnW+6YMh0W1BfNA8XSs6DLMGYlId5F3KnA70uu2qepcR08Qqg==", + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", "requires": { "whatwg-url": "^5.0.0" } @@ -6017,6 +5994,11 @@ "graceful-fs": "^4.1.2" } }, + "webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + }, "webpack": { "version": "5.79.0", "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.79.0.tgz", @@ -6130,11 +6112,6 @@ "integrity": "sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w==", "dev": true }, - "whatwg-fetch": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-3.6.2.tgz", - "integrity": "sha512-bJlen0FcuU/0EMLrdbJ7zOnW6ITZLrZMIarMUVmdKtsGvZna8vxKYaexICWPfZ8qwf9fzNq+UEIZrnSaApt6RA==" - }, "whatwg-url": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", @@ -6142,13 +6119,6 @@ "requires": { "tr46": "~0.0.3", "webidl-conversions": "^3.0.0" - }, - "dependencies": { - "webidl-conversions": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" - } } }, "which": { diff --git a/ui/package.json b/ui/package.json index f76ac5e05..39f4903cd 100644 --- a/ui/package.json +++ b/ui/package.json @@ -33,9 +33,9 @@ "d3": "7.3.0", "express": "^4.18.2", "express-http-proxy": "^1.6.3", - "fetch-retry": "5.0.3", + "fetch-retry": "5.0.6", "hls.js": "1.2.3", - "isomorphic-fetch": "3.0.0", + "node-fetch": "^2", "js-yaml": "4.1.0", "jszip": "^3.8.0", "libtess": "1.2.0", diff --git a/ui/server/server.js b/ui/server/server.js index 0a8856da7..ea90c8512 100644 --- a/ui/server/server.js +++ b/ui/server/server.js @@ -5,7 +5,15 @@ const nunjucks = require('nunjucks'); const favicon = require('serve-favicon'); const proxy = require('express-http-proxy'); const cookieParser = require('cookie-parser'); +const originalFetch = require('node-fetch'); +const fetch = require('fetch-retry')(originalFetch); +const dns = require('dns'); const yargs = require('yargs/yargs'); + +dns.setServers([ + '8.8.8.8', + '1.1.1.1', +]); const app = express(); const argv = yargs(process.argv.slice(2)) @@ -156,6 +164,8 @@ app.post('/exchange', async (req, res) => { const url = `${argv.backend}/auth/realms/tator/protocol/openid-connect/token`; try { await fetch(url, { + retries: 10, + retryDelay: 100, method: "POST", body: body, headers: { @@ -193,11 +203,15 @@ app.post('/exchange', async (req, res) => { }); }) .catch((error) => { - console.error(`Error in exchange endpoint: ${error}`); + console.error(`Error in fetch for exchange: ${error}`); + console.error(error.message); + console.error(error.stack); return Promise.reject(error); }); } catch (error) { console.error(`Error in exchange endpoint: ${error}`); + console.error(error.message); + console.error(error.stack); res.status(403).send({message: "Failed to retrieve access token!"}); } }); @@ -213,6 +227,8 @@ app.get('/refresh', async (req, res) => { const url = `${argv.backend}/auth/realms/tator/protocol/openid-connect/token`; try { await fetch(url, { + retries: 10, + retryDelay: 100, method: "POST", body: body, headers: { @@ -249,16 +265,48 @@ app.get('/refresh', async (req, res) => { }); }) .catch((error) => { - console.error(`Error in refresh endpoint: ${error}`); + console.error(`Error in fetch for refresh: ${error}`); + console.error(error.message); + console.error(error.stack); return Promise.reject(error); }); } catch (error) { console.error(`Error in refresh endpoint: ${error}`); + console.error(error.message); + console.error(error.stack); res.status(403).send({message: "Failed to refresh access token!"}); } } }); +app.get('/dnstest', async (req, res) => { + try { + await fetch(argv.backend, { + retries: 10, + retryDelay: 100, + method: "GET", + }) + .then(response => { + if (!response.ok) { + console.error(`Error: Request failed with status ${response.status} ${response.statusText}`); + throw new Error("Response from backend failed!"); + } + res.status(200).send({message: "DNS was resolved!"}); + }) + .catch((error) => { + console.error(`Error in fetch to backend: ${error}`); + console.error(error.message); + console.error(error.stack); + return Promise.reject(error); + }); + } catch (error) { + console.error(`Error in DNS test: ${error}`); + console.error(error.message); + console.error(error.stack); + res.status(400).send({message: "DNS test failed!"}); + } +}); + app.listen(argv.port, argv.host, () => { console.log('Started express server!'); }); diff --git a/ui/server/static/oidc.js b/ui/server/static/oidc.js index a31bbc4ca..529f6f3fa 100644 --- a/ui/server/static/oidc.js +++ b/ui/server/static/oidc.js @@ -3,7 +3,6 @@ function exchangeAuthToken () { const searchParams = currentUrl.searchParams; const origin = currentUrl.origin; const code = searchParams.get("code"); - const next = searchParams.get("state"); fetch("/exchange", { method: "POST", credentials: "same-origin", @@ -28,18 +27,10 @@ function exchangeAuthToken () { localStorage.setItem("id_token", data.id_token); localStorage.setItem("token_type", data.token_type); localStorage.setItem("issue_time", issueTime.toISOString()); - if (next) { - if (next[0] == '/') { - window.location.href = next; - } else { - window.location.href = "/projects"; - } - } else { - window.location.href = "/projects"; - } + window.location.href = "/projects"; }) .catch((error) => { console.error("Error exchanging token!"); - window.location.href = `/accounts/login&state=${window.location.pathname}`; + window.location.href = `/accounts/login`; }); } diff --git a/ui/server/static/require-login.js b/ui/server/static/require-login.js index dbf1061db..03c023d2e 100644 --- a/ui/server/static/require-login.js +++ b/ui/server/static/require-login.js @@ -8,7 +8,7 @@ function getCookie(name) { function goToLogin() { if (KEYCLOAK_ENABLED) { - window.location.href = `/accounts/login&state=${window.location.pathname}`; + window.location.href = `/accounts/login`; } else { window.location.href = `/accounts/login?next=${window.location.pathname}`; }