Why is my function middleware not active?

I created a middleware here: https://github.com/NullVoxPopuli/limber/pull/1733/files and locally, testing with npx wrangler has the desired behavior. but when I view my page's latest deploy: https://4186709a.limber-glimmer-tutorial.pages.dev/1-introduction/1-basics the middleware is not active. What debugging steps should I try?
Glimmer Tutorial
Interactive tutorial for learning Glimmer, Ember's reactivity and component system, as well as the syntax and patterns needed to be effective in Glimmer and Ember projects.
23 Replies
Hello, I’m Allie!
Do you have a tutorial for how to build it? I'm getting this error:
Cleanup error.
⠋ cleaning upCannot read properties of undefined (reading 'cleanup')
Cleanup error.
⠋ cleaning upCannot read properties of undefined (reading 'cleanup')
Appears to be coming from sync-dependencies-meta-injected
NullVoxPopuli
NullVoxPopuliOP7mo ago
At the root, pnpm i, pnpm build, then cd to that workspace folder, pnpm start, then in a separate terminal pnpm cf in that same folder Might need node 21
Hello, I’m Allie!
Oop  ERR_PNPM_BAD_PM_VERSION  This project is configured to use v8.15.4 of pnpm. Your current pnpm is v9.1.0 Getting this now:
codemirror-lang-glimmer-js:build: [!] SyntaxError: Unexpected identifier 'assert'
codemirror-lang-glimmer-js:build: at compileSourceTextModule (node:internal/modules/esm/utils:337:16)
codemirror-lang-glimmer-js:build: at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:163:18)
codemirror-lang-glimmer-js:build: at callTranslator (node:internal/modules/esm/loader:429:14)
codemirror-lang-glimmer-js:build: at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:435:30)
codemirror-lang-glimmer-js:build: [!] SyntaxError: Unexpected identifier 'assert'
codemirror-lang-glimmer-js:build: at compileSourceTextModule (node:internal/modules/esm/utils:337:16)
codemirror-lang-glimmer-js:build: at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:163:18)
codemirror-lang-glimmer-js:build: at callTranslator (node:internal/modules/esm/loader:429:14)
codemirror-lang-glimmer-js:build: at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:435:30)
Maybe try reproducing your issue in a new repo from scratch?
NullVoxPopuli
NullVoxPopuliOP7mo ago
what node version are you using? I don't want to. haha should I be doing more than just putting a functions folder in my built output / dist?
Hello, I’m Allie!
The functions folder should be in tutorials, then you would call wrangler pages dev dist or wrangler pages deploy dist
NullVoxPopuli
NullVoxPopuliOP7mo ago
ah ok, I'll try that I was cding in to dist to call wrangler hm, my deployment specified dist tho:
DeployPreview_Tutorial:
name: "Deploy: Preview"
runs-on: ubuntu-latest
timeout-minutes: 15
needs: [Build]
permissions:
contents: read
deployments: write
outputs:
tutorialUrl: ${{ steps.deploy.outputs.url }}
steps:
- uses: actions/download-artifact@v4
name: deploy-prep-dist
- id: deploy
uses: cloudflare/[email protected]
with:
branch: ${{ github.event.workflow_run.head_branch }}
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: limber-glimmer-tutorial
directory: ./deploy-prep-dist/tutorial/dist
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
DeployPreview_Tutorial:
name: "Deploy: Preview"
runs-on: ubuntu-latest
timeout-minutes: 15
needs: [Build]
permissions:
contents: read
deployments: write
outputs:
tutorialUrl: ${{ steps.deploy.outputs.url }}
steps:
- uses: actions/download-artifact@v4
name: deploy-prep-dist
- id: deploy
uses: cloudflare/[email protected]
with:
branch: ${{ github.event.workflow_run.head_branch }}
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: limber-glimmer-tutorial
directory: ./deploy-prep-dist/tutorial/dist
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
maybe this is the problem that ./directory would have the functions in it
Hello, I’m Allie!
I believe you want
directory: ./deploy-prep-dist/tutorial/dist
workingDirectory: ./deploy-prep-dist/tutorial
directory: ./deploy-prep-dist/tutorial/dist
workingDirectory: ./deploy-prep-dist/tutorial
NullVoxPopuli
NullVoxPopuliOP7mo ago
Hm, there isn't really enough log output here to see what happened: https://github.com/NullVoxPopuli/limber/actions/runs/9045738794/job/24855804935#step:3:23
GitHub
Deploy Preview · NullVoxPopuli/limber@9b7ad14
Glimdown playground for documentation, demos, etc. Contribute to NullVoxPopuli/limber development by creating an account on GitHub.
NullVoxPopuli
NullVoxPopuliOP7mo ago
No description
Hello, I’m Allie!
Did it fail? That looks like a success to me? Or are you looking for something else? Oh, the functions didn't upload... Did you add the workingDirectory?
NullVoxPopuli
NullVoxPopuliOP7mo ago
Yeah:
Hello, I’m Allie!
Weird it isn't logging it... Though also, it is using wrangler 2, which is a full major release behind...
NullVoxPopuli
NullVoxPopuliOP7mo ago
Oh no, i'll try upgrading the action
Hello, I’m Allie!
Looks like the Action is behind too... Not entirely sure it is maintained...
NullVoxPopuli
NullVoxPopuliOP7mo ago
Oh no. What would you recommend? Just using wrangler directly?
Hello, I’m Allie!
Probably the best idea. At least for now
NullVoxPopuli
NullVoxPopuliOP7mo ago
oh, how do you do a preview deploy wrangler? what's the difference between deploy and publish? oh maybe deploy is for preview and publish is for the main site
NullVoxPopuli
NullVoxPopuliOP7mo ago
GitHub
Fix workflows · NullVoxPopuli/limber@65a3cf5
Glimdown playground for documentation, demos, etc. Contribute to NullVoxPopuli/limber development by creating an account on GitHub.
NullVoxPopuli
NullVoxPopuliOP7mo ago
I guess I still made a preview deploy do I just omit the hash when I want a non-preview? omg it worked! yay oh, except my logic is wrong ha now all of my gjs requests are 404s good thing I haven't figured out production deploy oh no... but these deploys are production deploys ug I'm getting 500 errors, actually are there logs?
NullVoxPopuli
NullVoxPopuliOP7mo ago
No description
NullVoxPopuli
NullVoxPopuliOP7mo ago
ah so the response option's headers object is different than locally or maybe null is just one of the possibilities I need to account for success! it was that headers are sometimes null not headers, content-type, sorry the 304 case thanks for your help! How do I mark this as solved? nevermind, figured it out
Hello, I’m Allie!
publish is the old command, deploy is the new
Want results from more Discord servers?
Add your server