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

Create T3 App项目中调用方法报错 #82

Open
ss707494 opened this issue Jul 8, 2024 · 3 comments
Open

Create T3 App项目中调用方法报错 #82

ss707494 opened this issue Jul 8, 2024 · 3 comments

Comments

@ss707494
Copy link

ss707494 commented Jul 8, 2024

TypeError: hexoid is not a function
at eval (webpack-internal:///(rsc)/./node_modules/.pnpm/[email protected]/node_modules/formidable/src/Formidable.js:15:18)
at (rsc)/./node_modules/.pnpm/[email protected]/node_modules/formidable/src/Formidable.js (...\t3-next\.next\server\vendor-chunks\[email protected]:20:1)
at __webpack_require__ (...\t3-next\.next\server\webpack-runtime.js:33:43)
at eval (webpack-internal:///(rsc)/./node_modules/.pnpm/[email protected]/node_modules/formidable/src/index.js:5:20)
at (rsc)/./node_modules/.pnpm/[email protected]/node_modules/formidable/src/index.js (...\t3-next\.next\server\vendor-chunks\[email protected]:63:1)
at __webpack_require__ (...\t3-next\.next\server\webpack-runtime.js:33:43)
at eval (webpack-internal:///(rsc)/./node_modules/.pnpm/[email protected]/node_modules/superagent/lib/node/index.js:29:20)
at (rsc)/./node_modules/.pnpm/[email protected]/node_modules/superagent/lib/node/index.js (...\t3-next\.next\server\vendor-chunks\[email protected]:50:1)
at __webpack_require__ 

这个是我的调用方法


import fs from "node:fs";
import WxPay from "wechatpay-node-v3";

const pay = new WxPay({
  appid: "***",
  mchid: "***",
  publicKey: fs.readFileSync("./cert/apiclient_cert.pem"), // 公钥
  privateKey: fs.readFileSync("./cert/apiclient_key.pem"), // 秘钥
});

export const payNative = async () => {
  try {

    const params = {
      description: "测试",
      out_trade_no: "***",
      notify_url: "https://www.weixin.qq.com/wxpay/pay.php",
      amount: {
        total: 1,
      },
      scene_info: {
        payer_client_ip: "ip",
      },
    };

    const result = await pay.transactions_native(params);
    console.log(result);
  } catch (error) {
    console.error(error);
  }
  // # { status: 200, code_url: 'weixin://wxpay/bizpayurl?pr=9xFPmlUzz' }
};
@klover2
Copy link
Owner

klover2 commented Jul 16, 2024

TypeError: hexoid is not a function
at eval (webpack-internal:///(rsc)/./node_modules/.pnpm/[email protected]/node_modules/formidable/src/Formidable.js:15:18)
at (rsc)/./node_modules/.pnpm/[email protected]/node_modules/formidable/src/Formidable.js (...\t3-next\.next\server\vendor-chunks\[email protected]:20:1)
at __webpack_require__ (...\t3-next\.next\server\webpack-runtime.js:33:43)
at eval (webpack-internal:///(rsc)/./node_modules/.pnpm/[email protected]/node_modules/formidable/src/index.js:5:20)
at (rsc)/./node_modules/.pnpm/[email protected]/node_modules/formidable/src/index.js (...\t3-next\.next\server\vendor-chunks\[email protected]:63:1)
at __webpack_require__ (...\t3-next\.next\server\webpack-runtime.js:33:43)
at eval (webpack-internal:///(rsc)/./node_modules/.pnpm/[email protected]/node_modules/superagent/lib/node/index.js:29:20)
at (rsc)/./node_modules/.pnpm/[email protected]/node_modules/superagent/lib/node/index.js (...\t3-next\.next\server\vendor-chunks\[email protected]:50:1)
at __webpack_require__ 

这个是我的调用方法


import fs from "node:fs";
import WxPay from "wechatpay-node-v3";

const pay = new WxPay({
  appid: "***",
  mchid: "***",
  publicKey: fs.readFileSync("./cert/apiclient_cert.pem"), // 公钥
  privateKey: fs.readFileSync("./cert/apiclient_key.pem"), // 秘钥
});

export const payNative = async () => {
  try {

    const params = {
      description: "测试",
      out_trade_no: "***",
      notify_url: "https://www.weixin.qq.com/wxpay/pay.php",
      amount: {
        total: 1,
      },
      scene_info: {
        payer_client_ip: "ip",
      },
    };

    const result = await pay.transactions_native(params);
    console.log(result);
  } catch (error) {
    console.error(error);
  }
  // # { status: 200, code_url: 'weixin://wxpay/bizpayurl?pr=9xFPmlUzz' }
};

你指定一下superagent的版本 npm install [email protected] 看下可以吗

@airbai
Copy link

airbai commented Oct 18, 2024

报一样的错误:
@fly/nextjs:dev: ✓ Compiled /api/trpc/edge/[trpc] in 3.4s (6307 modules)
@fly/nextjs:dev: ⨯ TypeError: hexoid is not a function
@fly/nextjs:dev: at eval (webpack-internal:///(rsc)/../../node_modules/formidable/src/Formidable.js:15:18)
@fly/nextjs:dev: at (rsc)/../../node_modules/formidable/src/Formidable.js (/Users/b/Downloads/quanse/ai/fiit/saasfly/apps/nextjs/.next/server/vendor-chunks/formidable.js:20:1)
@fly/nextjs:dev: at webpack_require (/Users/b/Downloads/quanse/ai/fiit/saasfly/apps/nextjs/.next/server/webpack-runtime.js:33:43)
@fly/nextjs:dev: at eval (webpack-internal:///(rsc)/../../node_modules/formidable/src/index.js:5:20)
@fly/nextjs:dev: at (rsc)/../../node_modules/formidable/src/index.js (/Users/b/Downloads/quanse/ai/fiit/fly/apps/nextjs/.next/server/vendor-chunks/formidable.js:63:1)

@airbai
Copy link

airbai commented Oct 18, 2024

TypeError: hexoid is not a function
at eval (webpack-internal:///(rsc)/./node_modules/.pnpm/[email protected]/node_modules/formidable/src/Formidable.js:15:18)
at (rsc)/./node_modules/.pnpm/[email protected]/node_modules/formidable/src/Formidable.js (...\t3-next\.next\server\vendor-chunks\[email protected]:20:1)
at __webpack_require__ (...\t3-next\.next\server\webpack-runtime.js:33:43)
at eval (webpack-internal:///(rsc)/./node_modules/.pnpm/[email protected]/node_modules/formidable/src/index.js:5:20)
at (rsc)/./node_modules/.pnpm/[email protected]/node_modules/formidable/src/index.js (...\t3-next\.next\server\vendor-chunks\[email protected]:63:1)
at __webpack_require__ (...\t3-next\.next\server\webpack-runtime.js:33:43)
at eval (webpack-internal:///(rsc)/./node_modules/.pnpm/[email protected]/node_modules/superagent/lib/node/index.js:29:20)
at (rsc)/./node_modules/.pnpm/[email protected]/node_modules/superagent/lib/node/index.js (...\t3-next\.next\server\vendor-chunks\[email protected]:50:1)
at __webpack_require__ 

这个是我的调用方法


import fs from "node:fs";
import WxPay from "wechatpay-node-v3";

const pay = new WxPay({
  appid: "***",
  mchid: "***",
  publicKey: fs.readFileSync("./cert/apiclient_cert.pem"), // 公钥
  privateKey: fs.readFileSync("./cert/apiclient_key.pem"), // 秘钥
});

export const payNative = async () => {
  try {

    const params = {
      description: "测试",
      out_trade_no: "***",
      notify_url: "https://www.weixin.qq.com/wxpay/pay.php",
      amount: {
        total: 1,
      },
      scene_info: {
        payer_client_ip: "ip",
      },
    };

    const result = await pay.transactions_native(params);
    console.log(result);
  } catch (error) {
    console.error(error);
  }
  // # { status: 200, code_url: 'weixin://wxpay/bizpayurl?pr=9xFPmlUzz' }
};

解决了吗?怎么解读的

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants