Adi
Adi
CDCloudflare Developers
Created by bloushi on 5/14/2024 in #pages-help
Debugging a deploy issue in a Remix + Vite Project
The only thing I can think off for react-email is to remember to enable nodejs_compat in production
13 replies
CDCloudflare Developers
Created by bloushi on 5/14/2024 in #pages-help
Debugging a deploy issue in a Remix + Vite Project
Like you suggested, I have it split out into it's own worker right now (using RPC), other projects call into it
13 replies
CDCloudflare Developers
Created by bloushi on 5/14/2024 in #pages-help
Debugging a deploy issue in a Remix + Vite Project
oooh you're using react-email? Yeah look I've had a lot of issues with that even in workers. Especially if you add in tailwind it makes a massive bundle. Maybe you're hitting some limits there?
13 replies
CDCloudflare Developers
Created by ai.alok on 5/13/2024 in #pages-help
Get Previews for PRs from forks
I haven't tried for forks, but the steps above work for PRs in the main repo. I shared it to give an example of how one might do preview comments. For forks, you'll just have to work out how to grant access to secrets etc. Which I think are available if you approve workflows?
22 replies
CDCloudflare Developers
Created by ai.alok on 5/13/2024 in #pages-help
Get Previews for PRs from forks
Unfortunately it's a private repo, I can't share it
22 replies
CDCloudflare Developers
Created by bloushi on 5/14/2024 in #pages-help
Debugging a deploy issue in a Remix + Vite Project
Just to give you some hope, I am running multiple remix vite apps in production, so it's definitely possible. Don't give up :MeowHeartCloudflare:
13 replies
CDCloudflare Developers
Created by bloushi on 5/14/2024 in #pages-help
Debugging a deploy issue in a Remix + Vite Project
Just to confirm, when you're running it locally, are you using vite dev or running a full build then using pages dev
13 replies
CDCloudflare Developers
Created by alka_99 on 5/11/2024 in #pages-help
Email Provider compatible with cloudflare pages
You'll need to use their REST API. Something like this
const response = await fetch('https://api.sendgrid.com/v3/mail/send', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${env.SENDGRID_API_KEY}`,
},
body: JSON.stringify({
personalizations: [{ to: [{ email: options.to }], subject: options.subject }],
from: { email: 'from-email' },
reply_to: { email: 'to-email' },
content: [
{
type: 'text/plain',
value: 'YOUR_EMAIL_TEXT',
},
{
type: 'text/html',
value: 'YOUR_EMAIL_HTML',
},
],
mail_settings: { sandbox_mode: false // as-needed } },
}),
});
const response = await fetch('https://api.sendgrid.com/v3/mail/send', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${env.SENDGRID_API_KEY}`,
},
body: JSON.stringify({
personalizations: [{ to: [{ email: options.to }], subject: options.subject }],
from: { email: 'from-email' },
reply_to: { email: 'to-email' },
content: [
{
type: 'text/plain',
value: 'YOUR_EMAIL_TEXT',
},
{
type: 'text/html',
value: 'YOUR_EMAIL_HTML',
},
],
mail_settings: { sandbox_mode: false // as-needed } },
}),
});
3 replies
CDCloudflare Developers
Created by ai.alok on 5/13/2024 in #pages-help
Get Previews for PRs from forks
Had to send it as a file, the message was too long
22 replies
CDCloudflare Developers
Created by ai.alok on 5/13/2024 in #pages-help
Get Previews for PRs from forks
You can absolutely have pull requests make preview branches and comment that back to your PR. Here is how I did it in an existing repo (I've changed some naming up). A few things to note on this workflow - It's built for monorepos where you have multiple webapps (like turborepo) - When it runs on the main branch it will simply deploy all the pages projects - When it runs on a pull request trigger it will create preview deployments and comment those back onto the PR - The code is written in a way where you can easily add more webapps and add them to the preview comment
22 replies
CDCloudflare Developers
Created by bloushi on 5/14/2024 in #pages-help
Debugging a deploy issue in a Remix + Vite Project
+1 to what James said. Running pages dev locally is a great way to debug issues. Just off the top of my head tho, one thing I encountered when migrating to Vite was that I forgot to change my _routes.json and _headers file. Remember that previously assets were stored under the build folder in public. That's no longer the case. You want your _routes.json file to look like this
{
"version": 1,
"include": ["/*"],
"exclude": ["/favicon.ico", "/assets/*"]
}
{
"version": 1,
"include": ["/*"],
"exclude": ["/favicon.ico", "/assets/*"]
}
And _headers to look like this
/favicon.ico
Cache-Control: public, max-age=3600, s-maxage=3600
/assets/*
Cache-Control: public, max-age=31536000, immutable
/favicon.ico
Cache-Control: public, max-age=3600, s-maxage=3600
/assets/*
Cache-Control: public, max-age=31536000, immutable
There is an open PR to fix this in the Vite template, just not merged yet - https://github.com/remix-run/remix/pull/8722
13 replies
CDCloudflare Developers
Created by MetalGear on 5/15/2024 in #pages-help
React Server Components support?
Afaik you can run Next.js on Pages using https://github.com/cloudflare/next-on-pages Since Next.js already runs RSC, there shouldn't be any lack of support.
2 replies
CDCloudflare Developers
Created by Manuel Ogomigo on 5/5/2024 in #pages-help
Cannot Interact with D1 Locally on Cloudflare Pages
Ahh, ok not really sure what the process is to setup interactions without a framework. I know frameworks like remix use getPlatformProxy internally to communicate with wrangler and Miniflare - https://developers.cloudflare.com/workers/wrangler/api/#getplatformproxy
7 replies
CDCloudflare Developers
Created by Manuel Ogomigo on 5/5/2024 in #pages-help
Cannot Interact with D1 Locally on Cloudflare Pages
Hey 👋 Could you share what framework you're using on CF Pages? I've had this work flawlessly for me in Remix for a while.
7 replies
CDCloudflare Developers
Created by Adi on 5/1/2024 in #workers-discussions
smart placement + RPC
Hey Max. First off thank you for answering the question! I was getting a bit bummed with the long delay haha. And understood, good to know that it's planned work / on the roadmap. I was thinking of moving my Pages -> worker communication to RPC, but I didn't want to shoot myself in the foot if this was never going to be optimized and made compliant, good to know that it will work eventually 🙂
2 replies
CDCloudflare Developers
Created by Wesley on 5/1/2024 in #workers-help
Question about deployment
Most frameworks, like the ones you listed, have adapters for both, but I would recommend Cloudflare Pages. I believe worker sites are deprecated, and underneath the hood Cloudflare Pages uses workers anyway. Most frameworks will have guides on how to deploy to Cloudflare, e.g here is the Nuxt guide - https://nuxt.com/deploy/cloudflare Cloudflare also has a large number of framework guides for Pages deployments - https://developers.cloudflare.com/pages/framework-guides/
3 replies