Open alessmar opened 11 months ago
@paweljedrzejczyk I was able to fix the issue by creating a specific error handler, like below:
const staticMiddleware = serveStatic(STATIC_PATH, { index: false });
const staticErrorHandler = (error, req, res, next) => {
console.warn("url:", req.originalUrl, "error:", error.message);
if(req.originalUrl.startsWith('/assets')) {
staticMiddleware(req, res, next);
} else {
next();
}
}
....
....
app.use(staticMiddleware);
app.use(
"/*",
useShopifyApp((shopifyApp) => shopifyApp.ensureInstalledOnShop()),
async (_req, res, _next) => {
return res
.status(200)
.set("Content-Type", "text/html")
.send(readFileSync(join(STATIC_PATH, "index.html")));
}
);
app.use(staticErrorHandler);
I get the error below whenever the web client tries to load resources like /assets/index-694b4c0c.css I get:
below my
index.js
file:the dependency declared in package.json is:
"@paweljedrzejczyk/shopify-multistore-app-middleware": "^0.1.0",
Is there anything I can do to avoid this issue?