Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] [POC] Invoke function from another function #1498

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions apps/products-feed/src/pages/api/hello.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import type { NextApiRequest, NextApiResponse } from "next";
import { createLogger } from "../../logger";
import { wrapWithLoggerContext } from "@saleor/apps-logger/node";
import { withOtel } from "@saleor/apps-otel";
import { loggerContext } from "../../logger-context";

const Wait = () => {
return new Promise((resolve) => setTimeout(resolve, 1000));
};

export const handler = async (req: NextApiRequest, res: NextApiResponse) => {
const logger = createLogger("Hello World!");

await Wait();
logger.info("Call from hellow wordl");

res.status(200).end();
};

export default wrapWithLoggerContext(
withOtel(handler, "/api/feed/[url]/[channel]/google.xml"),
loggerContext,
);
2 changes: 2 additions & 0 deletions apps/products-feed/src/pages/api/manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ export default wrapWithLoggerContext(

logger.info("Generating manifest");

fetch("https://saleor-app-products-feed-lm9js7sie-saleorcommerce.vercel.app/api/hello");

const manifest: AppManifest = {
about: "Generate feeds consumed by Merchant Platforms",
appUrl: iframeBaseUrl,
Expand Down
Loading