Error loading function from web module backend/http-functions.js

This is probably something simple that I am overlooking, but this is driving me crazy. Every time I try to call my edit function, I get this error:

import {created, ok, serverError} from 'wix-http-functions';
import wixData from 'wix-data';

export function put_editFNA(request) {
//my code

My insert function works fine. For some reason this function is not loading.
Why is it looking for use_editFNA when I am calling put?

1 Like

Hi, I was having this same issue but with exposing the API to GET requests. It was working when I pasted it in browsers and ran curl commands but did not work in my app. For me, the workaround was to make requests from my server-side rather than my client-side to avoid CORS issues it kept spamming at me. (i.e. in my NodeJS app, I used node-fetch API instead of the client-side javascript fetch API)

UPDATE: Moving to server-side only fixed my CORS issue and still saw the “use_myFunction” errors even though I’m using POST. At first I thought this was a security permissions setting but there was this error saying use_myFunction is not found. According to documentation - use - Velo API Reference - - All HTTP requests to the function will be routed to a user created USE() function unless another function is defined specifically for the request’s HTTP method. In other words, if something goes wrong, it falls back to the use_myFunction() version of your method.

As a temporary work around for this, I copied my POST code into my use_myFunction() function to allow the code to still run and return to the user. Basically having two functions with same name but one has “use” prefix and one is “post” prefix.

If Wix support can please make a fix or some insight into this, please let us know.

I had this same issue and thought I would leave my solution here in case it is helpful.

This was caused by my misunderstanding of CORS. The use_myFunction was called because the browser was sending a preflight OPTIONS request .

So what I needed to do was to add an options_myFunction with a CORS header

export function options_myFunction(request) {
  return ok({
    headers: { "access-control-allow-origin": "*" }

as well as adding the CORS header to my post_myFunction

export function post_myFunction(request) {
  return ok({
    body: {},
    headers: { 'Access-Control-Allow-Origin': '*' }
1 Like