0

In my static Qwik app (adapter), I use this function addCustomer

    export const addCustomer = server$(async (data) => {... 

to perform some task in my MongoDB when click in a Btn

    <button onClick$={async () => {const resume = await addCustomer(customerRecord); ...}

, and everything works fine in development environment. So I pushed changes to production into Vercel host. Then when I use my function again it Fails giving me this error in browser console.

    Uncaught (in promise) DOMException: The operation is insecure.

HELP!

I tried with globalAction$(), they are globally available across the whole app. Think about it like a "public" action.

    export const useAddCustomer = globalAction$(async (data: any) => {...

It doesn't works in development neither in production.

Minimal reproduction. I create a new Qwik app, with react and static adapters. In header click link to visit Form route.

Project Repository

Vercel Deployment

Vercel Project

Maik col
  • 31
  • 4
  • where is your mongoDB instance hosted? are you using HTTPS protocol? – Giorgio Boa Aug 10 '23 at 08:32
  • I connect to MongoAtlas, in Cluster AWS / N. Virginia (us-east-1), using a .env variable `MONGODB_URI=mongodb+srv://user:password@cluster0...mongodb.net/nexasoft_customer?retryWrites=true&w=majority` – Maik col Aug 10 '23 at 23:20

0 Answers0