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

请求付款时报错? #5

Open
rockking00 opened this issue Jan 17, 2024 · 1 comment
Open

请求付款时报错? #5

rockking00 opened this issue Jan 17, 2024 · 1 comment

Comments

@rockking00
Copy link

POST request failed: AxiosError: Request failed with status code 422 at settle (/var/task/.next/server/chunks/854.js:1:18559) at IncomingMessage. (/var/task/.next/server/chunks/854.js:3:9204) at IncomingMessage.emit (node:events:529:35) at endReadableNT (node:internal/streams/readable:1368:12) at process.processTicksAndRejections (node:internal/process/task_queues:82:21) { code: 'ERR_BAD_REQUEST', config: { transitional: { silentJSONParsing: true, forcedJSONParsing: true, clarifyTimeoutError: false }, adapter: [ 'xhr', 'http' ], transformRequest: [ [Function (anonymous)] ], transformResponse: [ [Function (anonymous)] ], timeout: 0, xsrfCookieName: 'XSRF-TOKEN', xsrfHeaderName: 'X-XSRF-TOKEN', maxContentLength: -1, maxBodyLength: -1, env: { FormData: [Function], Blob: [class Blob] }, validateStatus: [Function: validateStatus], headers: Object [AxiosHeaders] { Accept: 'application/vnd.api+json', 'Content-Type': 'application/vnd.api+json', Authorization: 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhdWQiOiI5NGQ1OWNlZi1kYmI4LTRlYTUtYjE3OC1kMjU0MGZjZDY5MTkiLJqdGkiOiJmYWU0MThiNGZlNjE1ZWJiMmU5ZjIyZmRmNWZjYWMzOTJlMmQ2OTliY2E5MjMwODM2MmNlORkMzgyMTk0MDFlNWVjZDlhY2I5NDVhOGM1MCIsImlhdCI6MTcwNTM3ODEyMC43NzIwNTUsIm5iZiI6MTcwNTM3ODEyMC43NzIwNTgsImV4cCI6MjAyMDk5NzMyMC43NTQ2NzQsInN1YiI6IjE4NjQxNTAiLCJzY29wZXMiOltdfQ.cxP1oGdihr8gCdaz9GOK-Q5JG_2HqMGTx7crBFkLm2OYw_CW8lmgIUTtFQ0bhlT3ouOWs9rJjofARFGDaDF0JP_RKjtyoLR_eopDuVVN41QCOlx5rINPEF9zhy5sAlRqe1dhLqbvdZL2l9c2051iDX_riH3ueXImCBVvifPiI8NygW_Av0vJ1w5ufMsE3M9a8oNGpSPXUSNEBma6GnwIIGIRxaClFlAaqfIxK5iHcOyeCVNUnzpk-I-MvdmMwoe2MJ-tr8ntXZXeADlxJMfE8TD4NTbzXFEL6OJ6E1_jHPTKuFsgaNgJy_NYXmrUqG73sfThN_2KNUA_om80SS7GhvUGGoxPb6OpXBs-JvVH64EMzrLcmxLoRBquutffZCKMuPvGXDLmcZDev5eedniKpzhPDrLksWMcNc0xDaFTX0yz3xIoRjCy658F7SNCrptuS-1OrRYqpafvL6SgmbEmA0CNT2gV_nb-aoL6so8tubsii_025iqWCcJB7bzpF1Mz', 'User-Agent': 'axios/1.6.0', 'Content-Length': '265', 'Accept-Encoding': 'gzip, compress, deflate, br' }, baseURL: '/', method: 'post', url: 'https://api.lemonsqueezy.com/v1/checkouts', data: '{"data":{"type":"checkouts","attributes":{"checkout_data":{"custom":{"email":null,"userId":"37431628","username":"rockk","type":"single"}}},"relationships":{"store":{"data":{"type":"stores","id":"64392"}},"variant":{"data":{"type":"variants","id":"216580"}}}}}' }, request: <ref *1> ClientRequest { _events: [Object: null prototype] { abort: [Function (anonymous)], aborted: [Function (anonymous)], connect: [Function (anonymous)], error: [Function (anonymous)], socket: [Function (anonymous)], timeout: [Function (anonymous)], finish: [Function: requestOnFinish] }, _eventsCount: 7, _maxListeners: undefined, outputData: [], outputSize: 0, writable: true, destroyed: false, _last: true, chunkedEncoding: false, shouldKeepAlive: false, maxRequestsOnConnectionReached: false, _defaultKeepAlive: true, useChunkedEncodingByDefault: true, sendDate: false, _removedConnection: false, _removedContLen: false, _removedTE: false, strictContentLength: false, _contentLength: '265', _hasBody: true, _trailer: '', finished: true, _headerSent: true, _closed: false, socket: TLSSocket { _tlsOptions: [Object], _secureEstablished: true, _securePending: false, _newSessionPending: false, _controlReleased: true, secureConnecting: false, _SNICallback: null, servername: 'api.lemonsqueezy.com', alpnProtocol: false, authorized: true, authorizationError: null, encrypted: true, _events: [Object: null prototype], _eventsCount: 10, connecting: false, _hadError: false, _parent: null, _host: 'api.lemonsqueezy.com', _closeAfterHandlingError: false, _readableState: [ReadableState], _maxListeners: undefined, _writableState: [WritableS

/api/payment/subscribe status=500

博主你好,我部署在vercel,为什么请求付款时会报上面的错误?我把.env里该填的都填了啊?

@weijunext
Copy link
Owner

email不能为空👇
{"email":null,"userId":"37431628","username":"rockk","type":"single"}

请先排查 api/api/payment/subapi/payment/subscribe/route.ts中下面这段代码查出来的user信息是否携带email:

    const user = await prisma.user.findUnique({
      where: { userId: userId.toString() },
      select: { userId: true, email: true, username: true },
    });

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

2 participants