HTTP call from Compute service

Comments

4 comments

  • Harry Kanami

    Hi Vinaayakh can you please provide the error message you got?

    0
    Comment actions Permalink
  • Vinaayakh

     

    error during execution process:
         assets by status 103 KiB [cached] 2 assets
         orphan modules 57.9 KiB [orphan] 13 modules
         runtime modules 3.25 KiB 8 modules
         cacheable modules 271 KiB
           modules with errors 468 bytes [errors]
             optional modules 78 bytes [optional]
               node:process 39 bytes [optional] [built] [code generated] [1 error]
               node:stream/web 39 bytes [optional] [built] [code generated] [1 error]
             + 10 modules
           modules by path ./ 270 KiB
             modules by path ./node_modules/fetch-blob/ 12.6 KiB
               ./node_modules/fetch-blob/from.js 2.59 KiB [built] [code generated]
               ./node_modules/fetch-blob/index.js 7.26 KiB [built] [code generated]
               + 2 modules
             + 5 modules
         
         WARNING in ./node_modules/node-domexception/index.js 5:31-56
         Module not found: Error: Can't resolve 'worker_threads'

    This is the start of it.

    ERROR in node:https
         Module build failed: UnhandledSchemeError: Reading from "node:https" is not handled
         by plugins (Unhandled scheme).
         Webpack supports "data:" and "file:" URIs by default.
         You may need an additional plugin to handle "node:" URIs.

    And I see similar error as above for node:buffer, node:https and other dependencies

    0
    Comment actions Permalink
  • Kyle Kingery

    Hi Vinaayakh,

    At this time, the only supported way to send HTTP requests is through our SDK directly. You will need to declare the destination as a backend ahead of time. Let me know if you have any additional questions.

     

    Kind regards,
    Kyle | Fastly Support

    0
    Comment actions Permalink
  • Vinaayakh

    I have added my new Backend and I tried calling it using the code below

    let upstreamHeaders = new Headers({ "some-header": "someValue" });
    let bodyObject = { 'testcontent': 'bodycontent' };
    let upstreamRequest = new Request("https://example.com/", {
        method: "POST",
      headers: upstreamHeaders,
    body: bodyObject
    });

    let fetchResponse = await fetch(upstreamRequest, {
        backend: "example_backend",
    });

    But when I try to log the data at my backend I only get the headers. Body is empty. What is the correct way to send body content?

    0
    Comment actions Permalink

Please sign in to leave a comment.