supergreg
supergreg
CCConvex Community
Created by supergreg on 5/18/2023 in #support-community
`convex/http.js` must have a default export of a Router.
Still stuck on the sendImage problem, but today is presentation day so that will wait 🙂
27 replies
CCConvex Community
Created by supergreg on 5/18/2023 in #support-community
`convex/http.js` must have a default export of a Router.
Yes! It is working, I guess changing build commands takes a while to go into effect
27 replies
CCConvex Community
Created by supergreg on 5/18/2023 in #support-community
`convex/http.js` must have a default export of a Router.
Oh hang on, it might have just taken 10 minutes to get Vercel's act together, let me test something
27 replies
CCConvex Community
Created by supergreg on 5/18/2023 in #support-community
`convex/http.js` must have a default export of a Router.
For build command I've tried nextjs build && npx convex deploy and npm run build && npx convex deploy but both show the same error, even after pushing a change ->Github->Vercel
27 replies
CCConvex Community
Created by supergreg on 5/18/2023 in #support-community
`convex/http.js` must have a default export of a Router.
Running into a larger problem, which is that I can't get it to work on Vercel. It's deployed to https://print-generator.vercel.app but keeps showing error
[CONVEX Q(getImages.js:default)] Could not find public function for 'getImages'. Did you forget to run `npx convex dev` or `npx convex deploy`?
[CONVEX Q(getImages.js:default)] Could not find public function for 'getImages'. Did you forget to run `npx convex dev` or `npx convex deploy`?
27 replies
CCConvex Community
Created by supergreg on 5/18/2023 in #support-community
`convex/http.js` must have a default export of a Router.
No description
27 replies
CCConvex Community
Created by supergreg on 5/18/2023 in #support-community
`convex/http.js` must have a default export of a Router.
Testing now 🙂
27 replies
CCConvex Community
Created by supergreg on 5/18/2023 in #support-community
`convex/http.js` must have a default export of a Router.
And changed
async function uploadImageToConvex(imageUrl, prompt) {
const response = await fetch(imageUrl);
const imageBlob = await response.blob();

const sendImageUrl = new URL(`${process.env.NEXT_PUBLIC_CONVEX_SITE}/sendImage`);
sendImageUrl.searchParams.set("prompt", prompt);

await fetch(sendImageUrl, {
method: "POST",
headers: { "Content-Type": imageBlob.type },
body: imageBlob,
});
}
async function uploadImageToConvex(imageUrl, prompt) {
const response = await fetch(imageUrl);
const imageBlob = await response.blob();

const sendImageUrl = new URL(`${process.env.NEXT_PUBLIC_CONVEX_SITE}/sendImage`);
sendImageUrl.searchParams.set("prompt", prompt);

await fetch(sendImageUrl, {
method: "POST",
headers: { "Content-Type": imageBlob.type },
body: imageBlob,
});
}
to use .site instead of cloud
27 replies
CCConvex Community
Created by supergreg on 5/18/2023 in #support-community
`convex/http.js` must have a default export of a Router.
Ok now I have NEXT_PUBLIC_CONVEX_URL="https://avid-badger-157.convex.cloud" NEXT_PUBLIC_CONVEX_SITE="https://avid-badger-157.convex.site"
27 replies
CCConvex Community
Created by supergreg on 5/18/2023 in #support-community
`convex/http.js` must have a default export of a Router.
And thank you for the help @sshader, really appreciate it. I've been banging my head on this for a while 😦
27 replies
CCConvex Community
Created by supergreg on 5/18/2023 in #support-community
`convex/http.js` must have a default export of a Router.
Is that wrong?
27 replies
CCConvex Community
Created by supergreg on 5/18/2023 in #support-community
`convex/http.js` must have a default export of a Router.
Yeah: const sendImageUrl = new URL(${process.env.NEXT_PUBLIC_CONVEX_URL}/sendImage);
27 replies
CCConvex Community
Created by supergreg on 5/18/2023 in #support-community
`convex/http.js` must have a default export of a Router.
My value is localhost
27 replies
CCConvex Community
Created by supergreg on 5/18/2023 in #support-community
`convex/http.js` must have a default export of a Router.
I don't have .site as a value, that's just the error text
27 replies
CCConvex Community
Created by supergreg on 5/18/2023 in #support-community
`convex/http.js` must have a default export of a Router.
also running into issues with CORS:
localhost/:1 Access to fetch at 'https://decisive-nightingale-272.convex.cloud/sendImage?prompt=cyberpunk+man+in+trenchcoat+holding+a+flag+that+says+%22I+love+AI%22' from origin 'http://localhost:3001' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
localhost/:1 Access to fetch at 'https://decisive-nightingale-272.convex.cloud/sendImage?prompt=cyberpunk+man+in+trenchcoat+holding+a+flag+that+says+%22I+love+AI%22' from origin 'http://localhost:3001' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
I followed the example so:
headers: new Headers({
// e.g. https://mywebsite.com
"Access-Control-Allow-Origin": process.env.CLIENT_ORIGIN,
Vary: "origin",
}),
headers: new Headers({
// e.g. https://mywebsite.com
"Access-Control-Allow-Origin": process.env.CLIENT_ORIGIN,
Vary: "origin",
}),
and my .env.local has CLIENT_ORIGIN=http://localhost:3001/
27 replies
CCConvex Community
Created by supergreg on 5/18/2023 in #support-community
`convex/http.js` must have a default export of a Router.
No description
27 replies
CCConvex Community
Created by supergreg on 5/18/2023 in #support-community
`convex/http.js` must have a default export of a Router.
It's also confusing to have the same file listed twice with different contents
27 replies
CCConvex Community
Created by supergreg on 5/18/2023 in #support-community
`convex/http.js` must have a default export of a Router.
Yes, that worked! Thank you 🙂
27 replies