diff --git a/utopia-remix/app/util/api.server.ts b/utopia-remix/app/util/api.server.ts index f6cd4830f6ca..a34bc259ecd1 100644 --- a/utopia-remix/app/util/api.server.ts +++ b/utopia-remix/app/util/api.server.ts @@ -8,7 +8,6 @@ import { getUserFromSession } from '../models/session.server' import * as cookie from 'cookie' import { Params } from '@remix-run/react' import { PrismaClientKnownRequestError } from 'prisma-client/runtime/library.js' -import { AxiosResponse } from 'axios' interface ErrorResponse { error: string @@ -114,15 +113,15 @@ export function ensure(condition: unknown, message: string, status: number): ass } } -export async function proxiedResponse(response: AxiosResponse): Promise { +export async function proxiedResponse(response: Response): Promise { if (response.status !== Status.OK) { - let text = await response.data + let text = await response.text() if (text.length === 0) { text = response.statusText } throw new ApiError(text, response.status) } - return response.data + return response.json() } export const SESSION_COOKIE_NAME = 'JSESSIONID' diff --git a/utopia-remix/app/util/proxy.server.ts b/utopia-remix/app/util/proxy.server.ts index 1a3a19ac177e..3ad6552e14c2 100644 --- a/utopia-remix/app/util/proxy.server.ts +++ b/utopia-remix/app/util/proxy.server.ts @@ -2,7 +2,6 @@ import urljoin from 'url-join' import { ServerEnvironment } from '../env.server' import { proxiedResponse } from './api.server' import dns from 'dns' -import axios, { AxiosHeaders } from 'axios' if (ServerEnvironment.environment === 'local') { // this is a workaround for default DNS resolution order with Node > 17 (where ipv6 comes first) @@ -26,23 +25,15 @@ export async function proxy(req: Request, options?: { rawOutput?: boolean; path? const url = buildProxyUrl(new URL(req.url), options?.path ?? null) console.log(`proxying call to ${url}`) - const headers = new AxiosHeaders() - for (const [key, value] of req.headers) { - headers.set(key, value) - } - - const data = await req.blob() - const resp = await axios.request({ - url: url, + const response = await fetch(url, { + credentials: 'include', method: req.method, - headers: headers, - data: data, - withCredentials: true, + body: req.body, + headers: req.headers, }) - if (options?.rawOutput) { - return resp + return response } - return proxiedResponse(resp) + return proxiedResponse(response) } diff --git a/utopia-remix/package.json b/utopia-remix/package.json index 71be1b379ac9..5a5f18f2da8b 100644 --- a/utopia-remix/package.json +++ b/utopia-remix/package.json @@ -21,7 +21,6 @@ "@remix-run/node": "2.5.1", "@remix-run/react": "2.5.1", "@remix-run/serve": "2.5.1", - "axios": "1.6.7", "cookie": "0.6.0", "dotenv": "16.4.1", "isbot": "4", diff --git a/utopia-remix/pnpm-lock.yaml b/utopia-remix/pnpm-lock.yaml index dc15624063ef..c2d4dfd00e00 100644 --- a/utopia-remix/pnpm-lock.yaml +++ b/utopia-remix/pnpm-lock.yaml @@ -22,7 +22,6 @@ specifiers: '@vanilla-extract/dynamic': 2.1.0 '@vanilla-extract/recipes': 0.5.1 '@vanilla-extract/sprinkles': 1.6.1 - axios: ^1.6.7 cookie: 0.6.0 dotenv: 16.4.1 eslint: 8.38.0 @@ -54,7 +53,6 @@ dependencies: '@remix-run/node': 2.5.1_typescript@5.1.6 '@remix-run/react': 2.5.1_i4rjfizg7pnsmg7p6yi76gfzdq '@remix-run/serve': 2.5.1_typescript@5.1.6 - axios: 1.6.7 cookie: 0.6.0 dotenv: 16.4.1 isbot: 4.4.0 @@ -3736,10 +3734,6 @@ packages: has-symbols: 1.0.3 dev: true - /asynckit/0.4.0: - resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==} - dev: false - /available-typed-arrays/1.0.6: resolution: {integrity: sha512-j1QzY8iPNPG4o4xmO3ptzpRxTciqD3MgEHtifP/YnJpIo58Xu+ne4BejlbkuaLfXn/nz6HFiw29bLpj2PNMdGg==} engines: {node: '>= 0.4'} @@ -3749,16 +3743,6 @@ packages: engines: {node: '>=4'} dev: true - /axios/1.6.7: - resolution: {integrity: sha512-/hDJGff6/c7u0hDkvkGxR/oy6CbCs8ziCsC7SqmhjfozqiJGc8Z11wrv9z9lYfY4K8l+H9TpjcMDX0xOZmx+RA==} - dependencies: - follow-redirects: 1.15.5 - form-data: 4.0.0 - proxy-from-env: 1.1.0 - transitivePeerDependencies: - - debug - dev: false - /axobject-query/3.2.1: resolution: {integrity: sha512-jsyHu61e6N4Vbz/v18DHwWYKK0bSWLqn47eeDSKPB7m8tqMHF9YJ+mhIk2lVteyZrY8tnSj/jHOv4YiTCuCJgg==} dependencies: @@ -4172,13 +4156,6 @@ packages: resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==} dev: true - /combined-stream/1.0.8: - resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==} - engines: {node: '>= 0.8'} - dependencies: - delayed-stream: 1.0.0 - dev: false - /comma-separated-tokens/2.0.3: resolution: {integrity: sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==} dev: true @@ -4384,11 +4361,6 @@ packages: object-keys: 1.1.1 dev: true - /delayed-stream/1.0.0: - resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==} - engines: {node: '>=0.4.0'} - dev: false - /depd/2.0.0: resolution: {integrity: sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==} engines: {node: '>= 0.8'} @@ -5228,16 +5200,6 @@ packages: resolution: {integrity: sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ==} dev: true - /follow-redirects/1.15.5: - resolution: {integrity: sha512-vSFWUON1B+yAw1VN4xMfxgn5fTUiaOzAJCKBwIIgT/+7CuGy9+r+5gITvP62j3RmaD5Ph65UaERdOSRGUzZtgw==} - engines: {node: '>=4.0'} - peerDependencies: - debug: '*' - peerDependenciesMeta: - debug: - optional: true - dev: false - /for-each/0.3.3: resolution: {integrity: sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==} dependencies: @@ -5251,15 +5213,6 @@ packages: signal-exit: 4.1.0 dev: true - /form-data/4.0.0: - resolution: {integrity: sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==} - engines: {node: '>= 6'} - dependencies: - asynckit: 0.4.0 - combined-stream: 1.0.8 - mime-types: 2.1.35 - dev: false - /format/0.2.2: resolution: {integrity: sha512-wzsgA6WOq+09wrU1tsJ09udeR/YZRaeArL9e1wPbFg3GG2yDnC2ldKpxs4xunpFF9DgqCqOIra3bc1HWrJ37Ww==} engines: {node: '>=0.4.x'} @@ -7847,10 +7800,6 @@ packages: forwarded: 0.2.0 ipaddr.js: 1.9.1 - /proxy-from-env/1.1.0: - resolution: {integrity: sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==} - dev: false - /pump/2.0.1: resolution: {integrity: sha512-ruPMNRkN3MHP1cWJc9OWr+T/xDP0jhXYCLfJcBuX54hhfIBnaQmAUMfDcG4DM5UMWByBbJY69QSphm3jtDKIkA==} dependencies: