Nuxt 3 - Server api function to cloudflare functio...
# pages-help
m
I am currently writing an Algolia indexer and webhook, however I am having some headaches where the functions work perfect in local, but when they are uploaded to Cloudflare as functions I am getting the following errors: The indexer as an algolia issue where when trying to access the index it returns a 500 error with the message Unreachable hosts - your application id may be incorrect. If the error persists, contact [support@algolia.com](support@algolia.com). The webhook as the same above message, however I am also having issues with crypto, where bodyHmac returns as [Function: fn$1] and not the encrypted string.
I understand that this is a lot to digest, and don’t expect full support, I was just hoping to get some guidence to where I am going wrong between local host and moving these to a cloudflare function.
I build this with
NITRO_PRESET=cloudflare-pages npx nuxi build
I solved this by installing @agolia/requester-fetch and adding
Copy code
import { createFetchRequester } from "@algolia/requester-fetch";
and
Copy code
const algolia = algoliasearch(
    config.public.algolia.applicationId,
    config.algolia.writeApiKey,
    {
      requester: createFetchRequester(),
    }