Skip to content

Commit

Permalink
fix shopify api version to one that we support
Browse files Browse the repository at this point in the history
  • Loading branch information
ajluker committed Oct 29, 2024
1 parent d6b32f0 commit 40af242
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions web/shopify.js
Original file line number Diff line number Diff line change
@@ -1,51 +1,51 @@
import '@shopify/shopify-api/adapters/node';
import { LATEST_API_VERSION } from '@shopify/shopify-api';
import * as dotenv from 'dotenv';
import { join } from 'path';
import { shopifyApp } from '@shopify/shopify-app-express';
import { restResources } from '@shopify/shopify-api/rest/admin/2023-01';
import { PostgreSQLSessionStorage } from '@shopify/shopify-app-session-storage-postgresql';
import "@shopify/shopify-api/adapters/node";
import { ApiVersion } from "@shopify/shopify-api";
import * as dotenv from "dotenv";
import { join } from "path";
import { shopifyApp } from "@shopify/shopify-app-express";
import { restResources } from "@shopify/shopify-api/rest/admin/2023-01";
import { PostgreSQLSessionStorage } from "@shopify/shopify-app-session-storage-postgresql";

if (['development', 'test'].includes(process.env.NODE_ENV)) {
if (["development", "test"].includes(process.env.NODE_ENV)) {
dotenv.config({
path: join(process.cwd(), '.env.test')
path: join(process.cwd(), ".env.test"),
});
} else {
dotenv.config({
path: join(process.cwd(), '.env')
path: join(process.cwd(), ".env"),
});
}

const DB_PATH = process?.env?.DATABASE_URL || '';
const DB_PATH = process?.env?.DATABASE_URL || "";

const { SHOPIFY_API_KEY, SHOPIFY_API_SECRET_KEY } = process.env;

const shopify = shopifyApp({
api: {
apiVersion: LATEST_API_VERSION,
hostName: process.env?.HOST?.replace(/https?:\/\//, '') || '',
apiVersion: ApiVersion.July24,
hostName: process.env?.HOST?.replace(/https?:\/\//, "") || "",
restResources,
apiKey: SHOPIFY_API_KEY,
apiSecretKey: SHOPIFY_API_SECRET_KEY,
billing: undefined,
scopes: [
'write_products',
'read_products',
'write_draft_orders',
'write_inventory',
'read_orders',
'write_orders',
'read_locations'
]
"write_products",
"read_products",
"write_draft_orders",
"write_inventory",
"read_orders",
"write_orders",
"read_locations",
],
},
auth: {
path: '/api/auth',
callbackPath: '/api/auth/callback'
path: "/api/auth",
callbackPath: "/api/auth/callback",
},
webhooks: {
path: '/api/webhooks'
path: "/api/webhooks",
},
sessionStorage: new PostgreSQLSessionStorage(DB_PATH)
sessionStorage: new PostgreSQLSessionStorage(DB_PATH),
});

export default shopify;

0 comments on commit 40af242

Please sign in to comment.