I'm trying to implement a simple form to trigger a search to an external API in a server action but all I see is an error: TypeError: e._formData.get is not a function
Everything works as expected in a clean project, but once Appwrite is installed it breaks. Anyone seen this/got a fix?
It should be working, did you find an error?
Getting "os" import errors
i'll send image in a bit
Which version of the package is that?
the one steven said, i saw there's also 0.0.33, but that one is broken as it has no exports
Heyo!
Please check out this gist :) https://gist.github.com/docimin/48b4ba32e987edda1743aa088e5c43ea
After removing export const runtime = 'edge'
, it works fine.
Version "luke-node-appwrite-edge": "0.0.32"
Thanks! Taking a look now
I keep getting spammed with "window is not defined" in the console, other than that not really helpful errors
I've published a new version 0.0.35 with some fixes. Hopefully we can merge it soon 🤞
cc @here
Hey, the ping didn't actually ping me, funnily enough.
There's another thing, still related to window is not defined
.
Having a page on SSR, with a client component imported using for example this kind of code:
'use client'
import { storage } from '@/app/appwrite-client'
export default function FetchGallery({ name, gallery }) {
const getGalleryImageUrl = (galleryId: string) => {
console.log(galleryId)
if (!galleryId) return
const imageId = storage.getFileView('655ca6663497d9472539', `${galleryId}`)
return imageId.href
}
const url = getGalleryImageUrl(gallery?.galleryId)
console.log(url)
// The rest of the component remains unchanged with conditional rendering based on the data's availability.
return (
<img
src={url}
alt={name || 'Image'}
className={`imgsinglegallery mx-auto h-[400px] w-auto max-w-full rounded-lg object-contain`}
/>
)
}
Will spam "window is not defined" every time you refresh the page. Most likely in the client sdk?
Again, removing export const runtime = 'edge'
will fix this issue, but then CF won't work anymore
Also, when trying to get documents, I get this error: Error: The 'credentials' field on 'RequestInitializerDict' is not implemented.
in CF Pages
Using this, importing from your sdk, version 0.0.36:
I also get this issue when trying to login via OAuth, using the SSR method
Also, just to clarify, even using the official way of using SSR like this, will not work
Not sure why window would be undefined if it is a client component. This error would only appear running on the server.
Published a fix for this with 0.0.37
Will try it soon, thanks!
The website still works FYI, but it just spams the console and on CF each request will have a message with that in it if you look under functions and follow the real-time logs
Can you fix it with if (typeof window === 'undefined') return;
in your getGalleryImageUrl
? Seems like cloudflare is trying to prerender the component
It happens locally too, just by adding the edge runtime
Oh I see. Could you share your @/app/appwrite-client
source?
it's super simple:
import {
Client,
Account,
Teams,
Databases,
Storage,
Functions,
Messaging,
Locale,
Avatars,
} from 'appwrite'
export const client = new Client()
.setEndpoint(`${process.env.NEXT_PUBLIC_API_URL}/v1`)
.setProject(`${process.env.NEXT_PUBLIC_APPWRITE_PROJECT_ID}`)
export const account: Account = new Account(client)
export const teams: Teams = new Teams(client)
export const databases: Databases = new Databases(client)
export const storage: Storage = new Storage(client)
export const functions: Functions = new Functions(client)
export const messaging: Messaging = new Messaging(client)
export const locale: Locale = new Locale(client)
export const avatars: Avatars = new Avatars(client)
export { ExecutionMethod, ID, Query } from 'appwrite'
Recommended threads
- How to Avoid Double Requests in function...
I'm currently using Appwrite's `functions.createExecution` in my project. I want to avoid double requests when multiple actions (like searching or pagination) a...
- Send Email Verification With REST
I am using REST to create a user on the server side after receiving form data from the client. After the account is successfully created i wanted to send the v...
- Use different email hosts for different ...
Hello, I have 2 projects and i want to be able to set up email templates in the projects. Both projects will have different email host configurations. I see ...