From 7abd6aa08cd63d07b6309c95dc28ccff21d7212e Mon Sep 17 00:00:00 2001 From: Michael Bromley Date: Wed, 19 Jan 2022 12:01:13 +0000 Subject: [PATCH] Attempt to fix netlify deploy issues --- .gitignore | 1 + app/commerce.server.ts | 9 +-------- .../ecommerce-providers/vendure.server.ts | 17 +---------------- netlify.toml | 2 +- 4 files changed, 4 insertions(+), 25 deletions(-) diff --git a/.gitignore b/.gitignore index 28f236d..c01e3f8 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ schema.graphql /.cache /build +/netlify/functions/server/build /public/build /app/styles/global.css .env diff --git a/app/commerce.server.ts b/app/commerce.server.ts index 10b1f3e..e6202e3 100644 --- a/app/commerce.server.ts +++ b/app/commerce.server.ts @@ -1,12 +1,5 @@ -import { createShopifyProvider } from "./models/ecommerce-providers/shopify.server"; -import { createSwrRedisCache } from "./models/request-response-caches/swr-redis-cache.server"; - -import redisClient from "./redis.server"; import { createVendureProvider } from '~/models/ecommerce-providers/vendure.server'; -let commerce = createVendureProvider({ - shop: process.env.SHOPIFY_STORE!, - maxAgeSeconds: 60, -}); +let commerce = createVendureProvider({}); export default commerce; diff --git a/app/models/ecommerce-providers/vendure.server.ts b/app/models/ecommerce-providers/vendure.server.ts index db4bb2c..2436bd2 100644 --- a/app/models/ecommerce-providers/vendure.server.ts +++ b/app/models/ecommerce-providers/vendure.server.ts @@ -14,15 +14,9 @@ import { getTranslations } from "~/translations.server"; export interface VendureProviderOptions { cache?: RequestResponseCache; - maxAgeSeconds?: number | ((request: Request) => number); - shop: string; } -export function createVendureProvider({ - cache, - maxAgeSeconds, - shop, - }: VendureProviderOptions): EcommerceProvider { +export function createVendureProvider({ cache }: VendureProviderOptions): EcommerceProvider { let href = process.env.VENDURE_API_URL || `https://demo.vendure.io/shop-api`; async function query( @@ -40,15 +34,6 @@ export function createVendureProvider({ body: JSON.stringify({query, variables}), }); - let maxAge = - typeof maxAgeSeconds === "function" - ? maxAgeSeconds(request.clone()) - : maxAgeSeconds; - - if (!nocache && cache && typeof maxAge === "number") { - return cache(request, maxAge).then((res) => res.json()); - } - const result = await fetch(request).then((res) => res.json()); if (result.errors?.length) { throw new Error(result.errors[0].message); diff --git a/netlify.toml b/netlify.toml index ec35702..ed61ab7 100644 --- a/netlify.toml +++ b/netlify.toml @@ -1,5 +1,5 @@ [build] - command = "remix build" + command = "npm build" functions = "netlify/functions" publish = "public"