He estado siguiendo la guía: https://shopify.dev/tutorials/build-a-shopify-app-with-node-and-react/ pero me e encontrado con un problema a la hora de instalar la app me aparece un error de
Internal Server Error
este es el error que me aparece en el npm :
| TypeError [ERR_INVALID_ARG_TYPE]: The “key” argument must be of type string or an instance of Buffer, TypedArray, DataView, or KeyObject. Received undefined at prepareSecretKey (internal/crypto/keys.js:304:11) at new Hmac (internal/crypto/hash.js:113:9) at Object.createHmac (crypto.js:143:10) at sign (C:\Users\mikil\Documents\sample-embedded-app\node_modules\keygrip\index.js:23:8) at Keygrip.sign (C:\Users\mikil\Documents\sample-embedded-app\node_modules\keygrip\index.js:30:38) at Cookies.set (C:\Users\mikil\Documents\sample-embedded-app\node_modules\cookies\index.js:110:30) at oAuthStart [email removed] at [email removed] at step (C:\Users\mikil\Documents\sample-embedded-app\node_modules\tslib\tslib.js:141:27) at Object.next (C:\Users\mikil\Documents\sample-embedded-app\node_modules\tslib\tslib.js:122:57) |
|---|
este en ngrok :
GET /auth 500 Internal Server Error GET /favicon.ico 302 Found GET /auth 500 Internal Server Error GET / 302 Found GET /auth 500 Internal Server Error GET /favicon.ico 302 Found GET /auth 500 Internal Server Error GET /auth 500 Internal Server Error GET /favicon.ico 302 Found GET /auth 500 Internal Server Error |
|---|
este es mi archivo de server.js
|
require(‘isomorphic-fetch’);
const dotenv = require(‘dotenv’);
const Koa = require(‘koa’);
const next = require(‘next’);
const { default: createShopifyAuth } = require(‘@shopify/koa-shopify-auth’);
const { verifyRequest } = require(‘@shopify/koa-shopify-auth’);
const session = require(‘koa-session’);
dotenv.config();
const port = parseInt(process.env.PORT, 10) || 3000;
const dev = process.env.NODE_ENV !== ‘production’;
const app = next({ dev });
const handle = app.getRequestHandler();
const { SHOPIFY_API_SECRET_KEY, SHOPIFY_API_KEY } = process.env;
app.prepare().then(() => {
const server = new Koa();
server.use(session({ secure: true, sameSite: ‘none’ }, server));
server.keys = [SHOPIFY_API_SECRET_KEY];
server.use(
createShopifyAuth({
apiKey: SHOPIFY_API_KEY,
secret: SHOPIFY_API_SECRET_KEY,
scopes: [‘read_products’],
afterAuth(ctx) {
const { shop, accessToken } = ctx.session;
ctx.redirect(‘/’);
},
}),
);
server.use(verifyRequest());
server.use(async (ctx) => {
await handle(ctx.req, ctx.res);
ctx.respond = false;
ctx.res.statusCode = 200;
return
});
server.listen(port, () => {
console.log(> Ready on http://localhost:${port});
});
});
|
| - |
la verdad no ubico el problema vi una solución en los foros en ingles pero a pesar de realizar lo no ha resultado.
alguien que me pueda orientar
Gracias