Im using quasar together with Vite and parse with back4app. I am having problems communicating with the parseserver after I build the app. It works fine in developmentmode.
How can I make this to work also with Vite? I havnt really changed any settings in quasar.config.js
In development mode I get the output as expected but once it is build I get:
IndexPage.23035fcf.js:1 Error fetching data: TypeError: J.default.fromJSON is not a function
at index.395acdc3.js:4:16160
at Array.map (<anonymous>)
at index.395acdc3.js:4:16037
at async o (IndexPage.23035fcf.js:1:1247)
o @ IndexPage.23035fcf.js:1
await in o (async)
h.onClick.e.<computed>.e.<computed> @ IndexPage.23035fcf.js:1
ot @ index.811214c9.js:1
Re @ index.811214c9.js:1
ml @ index.811214c9.js:1
B @ QBtn.bc39fdca.js:1
S @ QBtn.bc39fdca.js:1
ot @ index.811214c9.js:1
Re @ index.811214c9.js:1
n @ index.811214c9.js:1
IndexPage.23035fcf.js:1 Error fetching data: Error: Failed to fetch data from Parse.
at o (IndexPage.23035fcf.js:1:1317)
My boot file in boot folder in quasar:
import Parse from "parse";
export default async ({ app }) => {
const appId = import.meta.env.VITE_PARSE_APPLICATION_ID;
const jsKey = import.meta.env.VITE_PARSE_JS_KEY;
const parseKey = import.meta.env.VITE_PARSE_CLIENT_KEY;
Parse.initialize(appId, jsKey, parseKey);
Parse.serverURL = "https://parseapi.back4app.com"; // Set your Parse server URL
// Attach Parse to Vue instance or global scope if needed
app.config.globalProperties.$parse = Parse;
};
This is my component for query: const query = new Parse.Query("UploadedFiles"); let results = "";
try {
results = await query.find();
} catch (error) {
console.error("Error fetching data:", error);
throw new Error("Failed to fetch data from Parse.");
}
console.log("Response:", results); // Log response status
This is my .env:
VITE_PARSE_URL=https://parseapi.back4app.com
VITE_PARSE_APPLICATION_ID=XXXXXXXXXXXXXXXXXXXXXXXXXX
VITE_PARSE_JS_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXX
VITE_PARSE_CLIENT_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXX
VITE_PARSE_KEY=PARSE_CLIENT_KEY