Calling serverless function

Redwood doc is amazing, nevertheless I got frustrated that the serverless function page (Serverless Functions | RedwoodJS Docs) did not point to how to call my new serverless function from the frontend.

I created a signS3Put function with the generator, and in the frontend I am trying to call it using

  const response = await fetch(
    `${global.RWJS_API_URL}/signS3Put?s3ObjectType=${file.type}&s3ObjectName=${filename}`,
    { method: 'GET' }
  )

Unfortunately, this gives me a 404

Can someone point to me where I am doing something dumb?

Thank you :pray:

From what you shared that global should point to the api.

You should try to invoke your function via curl or Paw or even just in the browser to retest the exact url needed.

You might need to include “.redwood/functions” path?

See Serverless Functions (API Endpoints) | RedwoodJS Docs

Note that the .redwood/functions path is determined by your setting in your redwood.toml - and is used both in development and in the deployed Redwood app

1 Like

Thanks for the answer, this all helpful and accurate.
But it was my mistake, I was doing everything in storybook, and the server was not up.