Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
344 views
in Technique[技术] by (71.8m points)

google cloud firestore - Firebase HTTP request send same body to Woocommerce Rest API

I have an issue that once i triggered http request it always returns same error, even though body is sent different every time.

I send this body in request:

{"data":{"id":"moterims_aksesuarai_kaukes","name":"Kauk?s"}}

at error it's visible that this body was sent, even this was sent few days ago:

{"data": {"name":"Gro?is"}}

could it be that firebase somehow caches request? Or what could be the issue?

Error from log:

 at createError (/workspace/node_modules/@woocommerce/woocommerce-rest-api/node_modules/axios/lib/core/createError.js:16:15)
    at settle (/workspace/node_modules/@woocommerce/woocommerce-rest-api/node_modules/axios/lib/core/settle.js:17:12)
    at IncomingMessage.handleStreamEnd (/workspace/node_modules/@woocommerce/woocommerce-rest-api/node_modules/axios/lib/adapters/http.js:236:11)
    at IncomingMessage.emit (events.js:203:15)
    at IncomingMessage.EventEmitter.emit (domain.js:466:23)
    at endReadableNT (_stream_readable.js:1145:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)
  config:
   { url:
      'http://myproject.net/wp-json/wc/v3/products/categories',
     method: 'post',
     params:
      { oauth_consumer_key: 'ck_4b1c522f9fd846db76aa612b358d5e31ddb16659',
        oauth_nonce: '3yCmyqoo4TJYFViifcpWXsazXxUmccSB',
        oauth_signature_method: 'HMAC-SHA256',
        oauth_timestamp: 1609327534,
        oauth_version: '1.0',
        oauth_signature: '7kXV/wlBa5BRoMHZyMvoQ3G7l2EUHCpoEG0SpTgGr2M=' },
     data: '{"name":"Gro?is"}',
     headers:
      { Accept: 'application/json',
        'Content-Type': 'application/json;charset=utf-8',
        'User-Agent': 'WooCommerce REST API - JS Client/1.0.1',
        'Content-Length': 18 },
     transformRequest: [ [Function: transformRequest] ],
     transformResponse: [ [Function: transformResponse] ],
     timeout: 0,
     adapter: [Function: httpAdapter],
     responseType: 'json',
     xsrfCookieName: 'XSRF-TOKEN',
     xsrfHeaderName: 'X-XSRF-TOKEN',
     maxContentLength: -1,
     validateStatus: [Function: validateStatus],
     responseEncoding: 'utf8' },
  request:
   ClientRequest {
     domain:
      Domain {
        domain: null,
        _events: [Object],
        _eventsCount: 3,
        _maxListeners: undefined,
        members: [],
        [Symbol(kWeak)]: WeakReference {} },
     _events:
      [Object: null prototype] {
        socket: [Function],
        abort: [Function],
        aborted: [Function],
        error: [Function],
        timeout: [Function],
        prefinish: [Function: requestOnPrefinish] },
     _eventsCount: 6,
     _maxListeners: undefined,
     output: [],
     outputEncodings: [],
     outputCallbacks: [],
     outputSize: 0,
     writable: true,
     _last: true,
     chunkedEncoding: false,
     shouldKeepAlive: false,
     useChunkedEncodingByDefault: true,
     sendDate: false,
     _removedConnection: false,
     _removedContLen: false,
     _removedTE: false,
     _contentLength: null,
     _hasBody: true,
     _trailer: '',
     finished: true,
     _headerSent: true,
     socket:
      Socket {
        connecting: false,
        _hadError: false,
        _handle: [TCP],
        _parent: null,
        _host: 'myproject.net',
        _readableState: [ReadableState],
        readable: true,
        domain: [Domain],
        _events: [Object],
        _eventsCount: 7,
        _maxListeners: undefined,
        _writableState: [WritableState],
        writable: false,
        allowHalfOpen: false,
        _sockname: null,
        _pendingData: null,
        _pendingEncoding: '',
        server: null,
        _server: null,
        parser: null,
        _httpMessage: [Circular],
        [Symbol(asyncId)]: 724,
        [Symbol(lastWriteQueueSize)]: 0,
        [Symbol(timeout)]: null,
        [Symbol(kBytesRead)]: 0,
        [Symbol(kBytesWritten)]: 0 },
     connection:
      Socket {
        connecting: false,
        _hadError: false,
        _handle: [TCP],
        _parent: null,
        _host: 'myproject.net',
        _readableState: [ReadableState],
        readable: true,
        domain: [Domain],
        _events: [Object],
        _eventsCount: 7,
        _maxListeners: undefined,
        _writableState: [WritableState],
        writable: false,
        allowHalfOpen: false,
        _sockname: null,
        _pendingData: null,
        _pendingEncoding: '',
        server: null,
        _server: null,
        parser: null,
        _httpMessage: [Circular],
        [Symbol(asyncId)]: 724,
        [Symbol(lastWriteQueueSize)]: 0,
        [Symbol(timeout)]: null,
        [Symbol(kBytesRead)]: 0,
        [Symbol(kBytesWritten)]: 0 },
     _header:
      'POST /wp-json/wc/v3/products/categories?oauth_consumer_key=ck_4b1c522f9fd846db76aa612b358d5e31ddb16659&oauth_nonce=3yCmyqoo4TJYFViifcpWXsazXxUmccSB&oauth_signature_method=HMAC-SHA256&oauth_timestamp=1609327534&oauth_version=1.0&oauth_signature=7kXV%2FwlBa5BRoMHZyMvoQ3G7l2EUHCpoEG0SpTgGr2M%3D HTTP/1.1
Accept: application/json
Content-Type: application/json;charset=utf-8
User-Agent: WooCommerce REST API - JS Client/1.0.1
Content-Length: 18
Host: myproject.net
Connection: close

',
     _onPendingData: [Function: noopPendingOutput],
     agent:
      Agent {
        domain: null,
        _events: [Object],
        _eventsCount: 1,
        _maxListeners: undefined,
        defaultPort: 80,
        protocol: 'http:',
        options: [Object],
        requests: {},
        sockets: [Object],
        freeSockets: {},
        keepAliveMsecs: 1000,
        keepAlive: false,
        maxSockets: Infinity,
        maxFreeSockets: 256 },
     socketPath: undefined,
     timeout: undefined,
     method: 'POST',
     insecureHTTPParser: undefined,
     path:
      '/wp-json/wc/v3/products/categories?oauth_consumer_key=ck_4b1c522f9fd846db76aa612b358d5e31ddb16659&oauth_nonce=3yCmyqoo4TJYFViifcpWXsazXxUmccSB&oauth_signature_method=HMAC-SHA256&oauth_timestamp=1609327534&oauth_version=1.0&oauth_signature=7kXV%2FwlBa5BRoMHZyMvoQ3G7l2EUHCpoEG0SpTgGr2M%3D',
     _ended: true,
     res:
      IncomingMessage {
        _readableState: [ReadableState],
        readable: false,
        domain: [Domain],
        _events: [Object],
        _eventsCount: 3,
        _maxListeners: undefined,
        socket: [Socket],
        connection: [Socket],
        httpVersionMajor: 1,
        httpVersionMinor: 1,
        httpVersion: '1.1',
        complete: true,
        headers: [Object],
        rawHeaders: [Array],
        trailers: {},
        rawTrailers: [],
        aborted: false,
        upgrade: false,
        url: '',
        method: null,
        statusCode: 400,
        statusMessage: 'Bad Request',
        client: [Socket],
        _consuming: false,
        _dumped: false,
        req: [Circular],
        responseUrl:
         'http://myproject.net/wp-json/wc/v3/products/categories?oauth_consumer_key=ck_4b1c522f9fd846db76aa612b358d5e31ddb16659&oauth_nonce=3yCmyqoo4TJYFViifcpWXsazXxUmccSB&oauth_signature_method=HMAC-SHA256&oauth_timestamp=1609327534&oauth_version=1.0&oauth_signature=7kXV%2FwlBa5BRoMHZyMvoQ3G7l2EUHCpoEG0SpTgGr2M%3D',
        redirects: [] },
     aborted: undefined,
     timeoutCb: null,
     upgradeOrConnect: false,
     parser: null,
     maxHeadersCount: null,
     _redirectable:
      Writable {
        _writableState: [WritableState],
        writable: true,
        domain: [Domain],
        _events: [Object],
        _eventsCount: 2,
        _maxListeners: undefined,
        _options: [Object],
        _redirectCount: 0,
        _redirects: [],
        _requestBodyLength: 18,
        _requestBodyBuffers: [],
        _onNativeResponse: [Function],
        _currentRequest: [Circular],
        _currentUrl:
         'http://myproject.net/wp-json/wc/v3/products/categories?oauth_consumer_key=ck_4b1c522f9fd846db76aa612b358d5e31ddb16659&oauth_nonce=3yCmyqoo4TJYFViifcpWXsazXxUmccSB&oauth_signature_method=HMAC-SHA256&oauth_timestamp=1609327534&oauth_version=1.0&oauth_signature=7kXV%2FwlBa5BRoMHZyMvoQ3G7l2EUHCpoEG0SpTgGr2M%3D' },
     [Symbol(isCorked)]: false,
     [Symbol(outHeadersKey)]:
      [Object: null prototype] {
        accept: [Array],
        'content-type': [Array],
        'user-agent': [Array],
        'content-length': [Array],
        host: [Array] } },
  response:
   { status: 400,
     statusText: 'Bad Request',
     headers:
      { 'access-control-allow-headers':
         'Authorization, X-WP-Nonce, Content-Disposition, Content-MD5, Content-Type',
        'access-control-expose-headers': 'X-WP-Total, X-WP-TotalPages, Link',
        allow: 'GET, POST',
        'cache-control': 'no-cache, must-revalidate, max-age=0',
        'content-length': '157',
        'content-type': 'application/json; charset=UTF-8',
        date: 'Wed, 30 Dec 2020 11:25:34 GMT',
        expires: 'Wed, 11 Jan 1984 05:00:00 GMT',
        link:
         '<http://myproject.net/wp-json/>; rel="https://api.w.org/"',
        pragma: 'no-cache',
        server: 'Apache/2.4.38 (Debian)',
        'set-cookie': [Array],
        vary: 'Accept-Encoding',
        'x-content-type-options': 'nosniff',
        'x-powered-by': 'PHP/7.4.13',
        'x-robots-tag': 'noindex',
        connection: 'close' },
     config:
      { url:
         'http://myproject.net/wp-json/wc/v3/products/categories',
        method: 'post',
        params: [Object],
        data: '{"name":"Gro?is"}',
        headers: [Object],
        transformRequest: [Array],
        transformResponse: [Array],
        timeout: 0,
        adapter: [Function: httpAdapter],
        responseType: 'json',
        xsrfCookieName: 'XSRF-TOKEN',
        xsrfHeaderName: 'X-XSRF-TOKEN',
        maxContentLength: -1,
        validateStatus: [Function: validateStatus],
        responseEncoding: 'utf8' },
     request:
      ClientRequest {
        domain: [Domain],
        _events: [Object],
        _eventsCount: 6,
        _maxListeners: undefined,
        output: [],
        outputEncodings: [],
        outputCallbacks: [],
        outputSize: 0,
        writable: true,
        _last: true,
        chunkedEncoding: false,
        shouldKeepAlive: false,
        useChunkedEncodingByDefault: true,
        sendDate: false,
        _removedConnection: false,
        _removedContLen: false,
        _removedTE: false,
        _contentLength: null,
        _hasBody: true,
        _trailer: '',
        finished: true,
        _headerSent: true,
        socket: [Socket],
        connection: [Socket],
        _header:
         'POST /wp-json/wc/v3/products/categories?oauth_consumer_key=ck_4b1c522f9fd846db76aa612b358d5e31ddb16659&oauth_nonce=3yCmyqoo4TJYFViifcpWXsazXxUmccSB&oauth_signature_method=HMAC-SHA256&oauth_timestamp=1609327534&oauth_version=1.0&oauth_signature=7kXV%2FwlBa5BRoMHZyMvoQ3G7l2EUHCpoEG0SpTgGr2M%3D HTTP/1.1
Accept: application/json
Content-Type: application/json;charset=utf-8
User-Agent: WooCommerce REST API - JS Client/1.0.1
Content-Length: 18
Host: myproject.net
Connection: close

',
        _onPendingData: [Function: noopPendingOutput],
        agent: [Agent],
        socketPath: undefined,
        timeout: undefined,
        method: 'POST',
        insecureHTTPParser: undefined,
        path:
         '/wp-json/wc/v3/products/categories?oauth_consumer_key=ck_4b1c522f9fd846db76aa612b358d5e31ddb16659&oau

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...