The plugin documentation
The plugin documentation?
You're using normal git integration, added the html contact form as is (needs the
data-static-form-name
attribute to be set to anything), you have the functions folder in your root (not in your output directory) with the _middleware.ts file, you can see in build logs under the functions tab, the middleware listed under route configuration?18 Replies
I have the example form now. Just added lines so it's a little easier to read.
I'm uploading with wrangler. The middleware is in
functions/_middleware.ts
I'm getting a compiled worker success message before it uploads.You mean this with build logs?
I have this. Which is weird since I never set up any script called
submit
.Looks like you're missing the middleware
What does your functions folder look like? Anything other then _middleware.ts?
just
functions/_middleware.ts
and that's in the root of your project (where you're executing pages publish)?
not sure what you mean but it's in here. Wrangler command is
wrangler pages publish temp-out
.it needs to be in the folder you are executing the pages publish command from I believe, not the folder you specify as the output directory
ex.
and you execute
wrangler pages publish
while in project/Well… look what I found in there.
that's where that comes from. I just copied it away so it's not in the way.
(and don't forget to move the current functions folder with the _middleware.ts file up a level)
and now I'm getting errors. So that's progress. Does
Authentication error [code: 10000]
mean anything to you?From wrangler?
yep
That's weird if it suddenly started doing it now on publish when it didn't before. I would try again, or log out of wrangler and back in
Looks like sometimes if you logged in a really long time ago, the token wrangler got may be missing some newer permissions. If you did the exact same command as you've always done I wouldn't imagine that to be the case though
Boom! It uploaded. I tested. I got mail! Thank you so much for your patience. I really appreciate it.
Damn what a ride. So glad it's finally working.
nice! Yea functions can be a bit confusing that they have to be in the root folder, it wouldn't make sense for them to be in the upload directory, but it should still probably warn you that you may be doing something wrong
I had no doubt the functions go with the page content. The docs only talk about them in isolation, never in context. It just seemed logical. Especially given that I tell wrangler which folder to use. I never thought it would use something outside of that folder. So strange. Glad it's working now though.