Question:
Whenever I send a get
request to an http function, the response has status code 500
and body `x-wix-function-user-error` header missing exception
. What does this mean, and how do I fix it?
Product:
I’m using wix editor, in dev mode. Specifically, the functions I need are provided by the wix-stores-data-requests
velo package.
What have you already tried:
The only reference to this error that I could find is this old forum post. A few people reported seeing the error, but nobody posted a solution.
Additional information:
I’m sending the get requests with the following python code:
import requests
from _tokens_ import get_token
token = get_token("wix") #my "store secret", as directed by the readme
url = "https://my.site/store/_functions/storeInfo"
r=requests.get(url , headers = {'secretauth' : token})
print(r.status_code) #prints '500'
print(r.text) #prints '`x-wix-function-user-error` header missing exception'
The following code was copied into my site’s (otherwise empty) http-functions.js
file, as directed in the wix-stores-data-requests
package readme.
import {
get_storeInfo as _get_storeInfo,
put_updateProduct as _put_updateProduct,
get_products as _get_products
}
from '@velo/wix-stores-data-requests-backend';
export async function get_storeInfo(request) {
return await _get_storeInfo(request);
}
export async function put_updateProduct(request) {
return await _put_updateProduct(request);
}
export async function get_products(request) {
return await _get_products(request);
}
The request does not seem to be reaching the actual function at all. The response is the same, even if I deliberately misspell the function url: a get request to https://my.site/store/_functions/someGibberish
would receive the same response.
I’m stumped, y’all.