data
data
Explore posts from servers
NNuxt
Created by data on 11/4/2024 in #❓・help
import.meta.glob no longer typed properly
After regenerating the lockfile of my project, my import.meta.glob call is now no longer receiving the proper vite-client types. However they are in the nuxt.d.ts file. Has anyone else run into this?
const comps = import.meta.glob('@/dialogs/**/*.vue')
const comps = import.meta.glob('@/dialogs/**/*.vue')
Error: Property 'glob' does not exist on type 'ImportMeta'.ts-plugin(2339)
6 replies
CDCloudflare Developers
Created by data on 8/26/2024 in #pages-help
Nitro build hangs after Nuxt 3.13 upgrade
We use Nuxt (therefore nitro), something in the recent 3.13 update broke our build. Now it gets stuck, seemingly at the last stage before it prints "Finished"...
15:42:35.349 [success] Server built in 24226ms
15:42:35.478 [success] [nitro] Generated public dist
15:42:35.493 [info] [nitro] Building Nuxt Nitro server (preset: `cloudflare_pages`)
15:43:19.991 [success] [nitro] Nuxt Nitro server built
15:43:20.060 ├─ dist/_worker.js/chunks/_/error-500.mjs (4.67 kB) (2 kB gzip)
...
15:43:20.075 └─ dist/_worker.js/index.js (139 B) (145 B gzip)
15:43:20.075 Σ Total size: 3.19 MB (813 kB gzip)
15:43:20.075 [success] [nitro] You can preview this build using `npx wrangler pages dev dist/`
15:43:20.075 [success] [nitro] You can deploy this build using `npx wrangler pages deploy dist/`
15:42:35.349 [success] Server built in 24226ms
15:42:35.478 [success] [nitro] Generated public dist
15:42:35.493 [info] [nitro] Building Nuxt Nitro server (preset: `cloudflare_pages`)
15:43:19.991 [success] [nitro] Nuxt Nitro server built
15:43:20.060 ├─ dist/_worker.js/chunks/_/error-500.mjs (4.67 kB) (2 kB gzip)
...
15:43:20.075 └─ dist/_worker.js/index.js (139 B) (145 B gzip)
15:43:20.075 Σ Total size: 3.19 MB (813 kB gzip)
15:43:20.075 [success] [nitro] You can preview this build using `npx wrangler pages dev dist/`
15:43:20.075 [success] [nitro] You can deploy this build using `npx wrangler pages deploy dist/`
It gets stuck here and then the build times out after 20 minutes. While in previous versions it would log this after:
14:39:48.143 Finished
14:39:48.144 Found _worker.js in output directory. Uploading.
14:39:49.051 Attaching additional modules:
...
14:39:49.127 ✨ Compiled Worker successfully
14:39:49.239 Found _routes.json in output directory. Uploading.
14:39:49.251 Validating asset output directory
14:39:51.454 Deploying your site to Cloudflare's global network...
14:39:55.539 Uploading... (106/180)
14:39:56.176 Uploading... (130/180)
14:39:56.187 Uploading... (155/180)
14:39:56.989 Uploading... (180/180)
14:39:56.990 ✨ Success! Uploaded 74 files (106 already uploaded) (1.94 sec)
14:39:56.990
14:39:57.369 ✨ Upload complete!
14:39:48.143 Finished
14:39:48.144 Found _worker.js in output directory. Uploading.
14:39:49.051 Attaching additional modules:
...
14:39:49.127 ✨ Compiled Worker successfully
14:39:49.239 Found _routes.json in output directory. Uploading.
14:39:49.251 Validating asset output directory
14:39:51.454 Deploying your site to Cloudflare's global network...
14:39:55.539 Uploading... (106/180)
14:39:56.176 Uploading... (130/180)
14:39:56.187 Uploading... (155/180)
14:39:56.989 Uploading... (180/180)
14:39:56.990 ✨ Success! Uploaded 74 files (106 already uploaded) (1.94 sec)
14:39:56.990
14:39:57.369 ✨ Upload complete!
Apparently this pr changed the structure and functions invoked on compilation finished hook https://github.com/unjs/nitro/pull/2446 But... it also hangs when using the 2.10 nightly version 😦
1 replies
NNuxt
Created by data on 8/26/2024 in #❓・help
Cloudflare build hangs after upgrading to 3.13
We use Cloudflare Pages cloudflare_pages to deploy our app, it was working fine until the last update. Now it gets stuck, seemingly at the last stage before it prints "Finished"...
15:42:35.349 [success] Server built in 24226ms
15:42:35.478 [success] [nitro] Generated public dist
15:42:35.493 [info] [nitro] Building Nuxt Nitro server (preset: `cloudflare_pages`)
15:43:19.991 [success] [nitro] Nuxt Nitro server built
15:43:20.060 ├─ dist/_worker.js/chunks/_/error-500.mjs (4.67 kB) (2 kB gzip)
...
15:43:20.075 └─ dist/_worker.js/index.js (139 B) (145 B gzip)
15:43:20.075 Σ Total size: 3.19 MB (813 kB gzip)
15:43:20.075 [success] [nitro] You can preview this build using `npx wrangler pages dev dist/`
15:43:20.075 [success] [nitro] You can deploy this build using `npx wrangler pages deploy dist/`
15:42:35.349 [success] Server built in 24226ms
15:42:35.478 [success] [nitro] Generated public dist
15:42:35.493 [info] [nitro] Building Nuxt Nitro server (preset: `cloudflare_pages`)
15:43:19.991 [success] [nitro] Nuxt Nitro server built
15:43:20.060 ├─ dist/_worker.js/chunks/_/error-500.mjs (4.67 kB) (2 kB gzip)
...
15:43:20.075 └─ dist/_worker.js/index.js (139 B) (145 B gzip)
15:43:20.075 Σ Total size: 3.19 MB (813 kB gzip)
15:43:20.075 [success] [nitro] You can preview this build using `npx wrangler pages dev dist/`
15:43:20.075 [success] [nitro] You can deploy this build using `npx wrangler pages deploy dist/`
It gets stuck here and then the build times out after 20 minutes. While in previous verions it would log this after:
14:39:48.143 Finished
14:39:48.144 Found _worker.js in output directory. Uploading.
14:39:49.051 Attaching additional modules:
...
14:39:49.127 ✨ Compiled Worker successfully
14:39:49.239 Found _routes.json in output directory. Uploading.
14:39:49.251 Validating asset output directory
14:39:51.454 Deploying your site to Cloudflare's global network...
14:39:55.539 Uploading... (106/180)
14:39:56.176 Uploading... (130/180)
14:39:56.187 Uploading... (155/180)
14:39:56.989 Uploading... (180/180)
14:39:56.990 ✨ Success! Uploaded 74 files (106 already uploaded) (1.94 sec)
14:39:56.990
14:39:57.369 ✨ Upload complete!
14:39:48.143 Finished
14:39:48.144 Found _worker.js in output directory. Uploading.
14:39:49.051 Attaching additional modules:
...
14:39:49.127 ✨ Compiled Worker successfully
14:39:49.239 Found _routes.json in output directory. Uploading.
14:39:49.251 Validating asset output directory
14:39:51.454 Deploying your site to Cloudflare's global network...
14:39:55.539 Uploading... (106/180)
14:39:56.176 Uploading... (130/180)
14:39:56.187 Uploading... (155/180)
14:39:56.989 Uploading... (180/180)
14:39:56.990 ✨ Success! Uploaded 74 files (106 already uploaded) (1.94 sec)
14:39:56.990
14:39:57.369 ✨ Upload complete!
Has anyone had this issue? EDIT: a little bit of digging in the nitro prs and source code apparently this pr changed the structure and functions invoked on compilation finished hook https://github.com/unjs/nitro/pull/2446 tested, it also hangs on 2.10 nightly
1 replies
NNuxt
Created by data on 4/15/2024 in #❓・help
[OPEN] Working example of access/refresh token auth?
I didn't think this would be so complicated when I first started reading into Nuxt but after 4 different rewrite attempts I'm now a bit confused on whether it even makes sense. Does anyone have any resources or examples of an authentication flow where users are given an access token and refresh token? The features I'm looking for are: - Token rotation on expiration - Token invalidation - Server api guards (h3 layer) - Route guards (nuxt layer) & composables Because I want to load user data of private routes on the server, i need to always check if an access token is expired on each request... this means, that token rotation and expiration checking can be left entirely up to the server and the client no longer needs to worry about refreshing. This flow is very strange to me and non-standard from what i've been able to read, but I thought maybe this is what SSR-first apps need... Right now I have a working implementation that does all of the above (except route guards/composables), the server checks and rotates tokens on each request and then forwards the set-cookie header to nuxt, which uses appendResponseHeader and useRequestHeaders(['cookie']) in a custom fetch wrapper to forward cookies properly. However this does not work when user presses the back button, I get a weird node error, but in general I am very unhappy with this solution it feels hacky. Maybe token refresh is just not the move for an SSR environment? Would love to hear what you think, this is a major roadblock for me. I have also looked into Auth.js and sidebase-auth but they seem overkill for the simplicity I want and they seem to have the same weird edge cases.
3 replies
NNuxt
Created by data on 5/13/2023 in #❓・help
Does navigateTo clear any state set in middlewares?
No description
2 replies