Skip to content

Commit 2f2b777

Browse files
authored
feat: improve error logging in setup remote (#492)
1 parent 3217c05 commit 2f2b777

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/features.ts

+6
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,7 @@ export async function setupRemote(_nuxt: Nuxt, hub: HubConfig) {
329329
authorization: `Bearer ${hub.userToken}`
330330
}
331331
}).catch((err) => {
332+
log.debug(err)
332333
if (!err.status) {
333334
log.error('It seems that you are offline.')
334335
} else if (err.status === 401) {
@@ -390,11 +391,16 @@ export async function setupRemote(_nuxt: Nuxt, hub: HubConfig) {
390391
}
391392
})
392393
.catch(async (err) => {
394+
log.debug(err)
393395
let message = 'Project not found.\nMake sure to deploy the project using `npx nuxthub deploy` or add the deployed URL as `NUXT_HUB_PROJECT_URL` environment variable.'
394396
if (err.status >= 500) {
395397
message = 'Internal server error'
396398
} else if (err.status === 401) {
397399
message = 'Authorization failed.\nMake sure to provide a valid NUXT_HUB_PROJECT_SECRET_KEY or being logged in with `npx nuxthub login`'
400+
401+
if (hub.cloudflareAccess.clientId && hub.cloudflareAccess.clientSecret) {
402+
message += ', and ensure the provided NUXT_HUB_CLOUDFLARE_ACCESS_CLIENT_ID and NUXT_HUB_CLOUDFLARE_ACCESS_CLIENT_SECRET are valid.'
403+
}
398404
}
399405
log.error(`Failed to fetch remote storage: ${message}`)
400406
process.exit(1)

0 commit comments

Comments
 (0)