I'm using next/auth version: 3.27.3
I suddenly got this error while running my app. Anyone encountered this?
error - unhandledRejection: ReferenceError: defaultCookies is not defined
at C:\Users\MAGICSOFT Mike\Desktop\NEW MAGICSOFT\crd-prototype\node_modules\next-auth\dist\server\index.js:102:9
at new Promise (<anonymous>)
at NextAuthHandler (C:\Users\MAGICSOFT Mike\Desktop\NEW MAGICSOFT\crd-prototype\node_modules\next-auth\dist\server\index.js:67:10)
at NextAuth (C:\Users\MAGICSOFT Mike\Desktop\NEW MAGICSOFT\crd-prototype\node_modules\next-auth\dist\server\index.js:299:10)
at __WEBPACK_DEFAULT_EXPORT__ (C:\Users\MAGICSOFT Mike\Desktop\NEW MAGICSOFT\crd-prototype\.next\server\pages\api\auth\[...nextauth].js:188:128)
at Object.apiResolver (C:\Users\MAGICSOFT Mike\Desktop\NEW MAGICSOFT\crd-prototype\node_modules\next\dist\server\api-utils.js:101:15)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async DevServer.handleApiRequest (C:\Users\MAGICSOFT Mike\Desktop\NEW MAGICSOFT\crd-prototype\node_modules\next\dist\server\next-server.js:775:9)
at async Object.fn (C:\Users\MAGICSOFT Mike\Desktop\NEW MAGICSOFT\crd-prototype\node_modules\next\dist\server\next-server.js:666:37)
Seems like changing the next-auth version on your package.json file solves this issue.
For my case, changing from version "^3.29.0" to "3.29.3" solved the issue.
Related
I'm trying to deploy a NextJs project using Sanity at the backend side, at deployment this error occurs:
[13:36:44.275] Retrieving list of deployment files...
[13:36:44.750] Previous build caches not available
[13:36:44.799] Downloading 72 deployment files...
[13:36:45.460] Running "vercel build"
[13:36:45.926] Vercel CLI 28.10.0
[13:36:46.203] Installing dependencies...
[13:36:46.521] yarn install v1.22.17
[13:36:46.563] [1/4] Resolving packages...
[13:36:47.744] [2/4] Fetching packages...
[13:36:57.604] [3/4] Linking dependencies...
[13:36:57.606] warning " > next-sanity#3.1.9" has incorrect peer dependency "next#^13".
[13:37:07.243] [4/4] Building fresh packages...
[13:37:07.517] success Saved lockfile.
[13:37:07.520] Done in 21.00s.
[13:37:07.555] Detected Next.js version: 12.2.2
[13:37:07.556] Running "yarn run build"
[13:37:07.799] yarn run v1.22.17
[13:37:07.820] $ next build
[13:37:08.210] info - SWC minify release candidate enabled. https://nextjs.link/swcmin
[13:37:08.366] Attention: Next.js now collects completely anonymous telemetry regarding usage.
[13:37:08.366] This information is used to shape Next.js' roadmap and prioritize features.
[13:37:08.366] You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
[13:37:08.367] https://nextjs.org/telemetry
[13:37:08.367]
[13:37:08.624] info - Linting and checking validity of types...
[13:37:11.901] info - Creating an optimized production build...
[13:37:17.601] info - Compiled successfully
[13:37:17.601] info - Collecting page data...
[13:37:19.578] info - Generating static pages (0/3)
[13:37:19.717] (node:466) ExperimentalWarning: The Fetch API is an experimental feature. This feature could change at any time
[13:37:19.718] (Use `node --trace-warnings ...` to show where the warning was created)
[13:37:19.723]
[13:37:19.724] Error occurred prerendering page "/". Read more: https://nextjs.org/docs/messages/prerender-error
[13:37:19.724] TypeError: fetch failed
[13:37:19.724] at Object.fetch (node:internal/deps/undici/undici:11118:11)
[13:37:19.724] at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[13:37:19.724] at async fetchSkils (/vercel/path0/.next/server/pages/index.js:1197:17)
[13:37:19.724] at async getStaticProps (/vercel/path0/.next/server/pages/index.js:1091:20)
[13:37:19.724] at async renderToHTML (/vercel/path0/node_modules/next/dist/server/render.js:451:20)
[13:37:19.724] at async /vercel/path0/node_modules/next/dist/export/worker.js:251:36
[13:37:19.724] at async Span.traceAsyncFn (/vercel/path0/node_modules/next/dist/trace/trace.js:79:20)
[13:37:19.725] info - Generating static pages (3/3)
[13:37:19.725]
[13:37:19.725] > Build error occurred
[13:37:19.727] Error: Export encountered errors on following paths:
[13:37:19.727] /
[13:37:19.727] at /vercel/path0/node_modules/next/dist/export/index.js:395:19
[13:37:19.727] at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[13:37:19.727] at async Span.traceAsyncFn (/vercel/path0/node_modules/next/dist/trace/trace.js:79:20)
[13:37:19.728] at async /vercel/path0/node_modules/next/dist/build/index.js:1094:21
[13:37:19.728] at async Span.traceAsyncFn (/vercel/path0/node_modules/next/dist/trace/trace.js:79:20)
[13:37:19.728] at async /vercel/path0/node_modules/next/dist/build/index.js:971:17
[13:37:19.728] at async Span.traceAsyncFn (/vercel/path0/node_modules/next/dist/trace/trace.js:79:20)
[13:37:19.728] at async Object.build [as default] (/vercel/path0/node_modules/next/dist/build/index.js:64:29)
[13:37:19.762] error Command failed with exit code 1.
[13:37:19.762] info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
[13:37:19.779] Error: Command "yarn run build" exited with 1
After reading docs about the issue, I found that, the build cannot fetch data at this level during deployment( but it works fine on development side):
export const getStaticProps:GetStaticProps<Props> = async () => {
const skills: Skill[] = await fetchSkils();
const projects: Project[] = await fetchProjects();
const pageInfo: PageInfo = await fetchPageinfo();
const experiences: Experience[] = await fetchExperience();
return {
props: {
pageInfo,
experiences,
skills,
projects,
},
revalidate:1000,
};
};
I think that the mismatch between dependencies is the reason for it:
warning " > next-sanity#3.1.9" has incorrect peer dependency "next#^13".
So anybody knows what dependencies can work well together??
Vue2 is successful in writing like this,but using vue3 will prompt the following questions.
TypeError: Cannot read property 'getBanner' of undefined
at _callee$ (Banner.vue?40cf:46)
at tryCatch (runtime.js?96cf:63)
at Generator.invoke [as _invoke] (runtime.js?96cf:293)
at Generator.eval [as next] (runtime.js?96cf:118)
at asyncGeneratorStep (asyncToGenerator.js?1da1:3)
at _next (asyncToGenerator.js?1da1:25)
at eval (asyncToGenerator.js?1da1:32)
at new Promise (<anonymous>)
at eval (asyncToGenerator.js?1da1:21)
at Proxy.getBanner (Banner.vue?40cf:46)
I am getting this error when Firebase deploy in terminal. I can't find any of my code with Route.post() in. It looks like it s being called from a module ...
i deploying functions
i functions: ensuring necessary APIs are enabled...
✔ functions: all necessary APIs are enabled
i functions: preparing functions directory for uploading...
Error: Error occurred while parsing your function triggers.
Error: Route.post() requires a callback function but got a [object Undefined]
at Route.(anonymous function) [as post] (/Users/Desktop/castApp/functions/node_modules/express/lib/router/route.js:202:15)
at Function.app.(anonymous function) [as post] (/Users/Desktop/castApp/functions/node_modules/express/lib/application.js:482:19)
at Object.<anonymous> (/Users/Desktop/castApp/functions/index.js:12:5)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
In my case, this error occurred when I deleted the function in the controller file but didn't update the corresponding place where needs this function as a callback function in the router file - index.js.
index.js:
app.post('/new', addNew);
const { addStandupHost } = require('./APIs/candidates');
candidate.js:
// exports.addNew = (request, response) => {
// ...
// db operation here
// ...
//}
It was solved just by deleting the corresponding code in index.js. To avoid this error, we should keep functions export and import consistent.
When I tried to deploy a function on my local firebase emulator, I got this error
ERROR: Function load error: Code could not be loaded.
ERROR: Does the file exists? Is there a syntax error in your code?
ERROR: Detailed stack trace: /home/krishna/whozoo-firebase-web/functions/node_modules/firebase-functions/lib/config.js:51
throw new Error('Firebase config variables are not available. ' +
Error: Firebase config variables are not available. Please use the latest version of the Firebase CLI to deploy this function.
at init (/home/krishna/whozoo-firebase-web/functions/node_modules/firebase-functions/lib/config.js:51:15)
at Object.config (/home/krishna/whozoo-firebase-web/functions/node_modules/firebase-functions/lib/config.js:29:9)
at Object.<anonymous> (/home/krishna/whozoo-firebase-web/functions/index.js:7:31)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
ERROR: Error: Failed to deploy function.
at exec (/usr/local/lib/node_modules/#google-cloud/functions-emulator/src/cli/controller.js:135:18)
at ChildProcess.exithandler (child_process.js:213:5)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:877:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
Then I retried deploying after removing this particular line of code
admin.initializeApp(functions.config())
My function is deployed successfully but when I hit the endpoint, I end up with this message
{"code": "app/no-app","message": "The default Firebase app does not exist. Make sure you call initializeApp() before using any of the Firebase services."}
How can I solve this error?
EDIT
'use strict';
const admin = require('firebase-admin');
const functions = require('firebase-functions');
const register = require('./register');
admin.initializeApp(functions.config());
exports.register = functions.https.onRequest(register.registerHandler);
register.js
'use strict';
const functions = require('firebase-functions');
const admin = require('firebase-admin');
const cors = require('cors')
cors(req, res, () => {
let requestBody = req.body;
admin.auth().createUser({
'email': requestBody.email,
'emailVerified': false,
'password': requestBody.password,
'displayName': requestBody.firstName + '
' +requestBody.lastName
});
});
This is the part of register.js that I believe causes the problem. The rest of the register.js contains the response message.
Instead of this:
admin.initializeApp(functions.config());
Try this:
admin.initializeApp();
Also, put that line before you require your register module.
I have an async loaded module with async route functionallity in angular 2. In the main module I have an implementation which uses the component factory to instantiate the component I added to the async module with entryComponents.
When I now try to instantiate it, I get the following error:
Error: No component factory found for InEntryComponentsComponent. Did you add it to #NgModule.entryComponents?
at NoComponentFactoryError.ZoneAwareError (http://localhost:3000/polyfills.dll.js:4731:33)
at NoComponentFactoryError.BaseError [as constructor] (http://localhost:3000/vendor.dll.js:28595:16)
at new NoComponentFactoryError (http://localhost:3000/vendor.dll.js:28716:16)
at _NullComponentFactoryResolver.resolveComponentFactory (http://localhost:3000/vendor.dll.js:28733:15)
at AppModuleInjector.CodegenComponentFactoryResolver.resolveComponentFactory (http://localhost:3000/vendor.dll.js:28777:35)
at SwapComponentDirective.set [as swapCmp] (http://localhost:3000/main.bundle.js:2959:66)
at Wrapper_SwapComponentDirective.check_swapCmp (/ModalModule/SwapComponentDirective/wrapper.ngfactory.js:50:26)
at View_ModalOverlay2.detectChangesInternal (/ModalModule/ModalOverlay/component.ngfactory.js:83:36)
at View_ModalOverlay2.AppView.detectChanges (http://localhost:3000/vendor.dll.js:79810:14)
at View_ModalOverlay2.DebugAppView.detectChanges (http://localhost:3000/vendor.dll.js:80005:44)
at ViewContainer.detectChangesInNestedViews (http://localhost:3000/vendor.dll.js:80143:37)
at CompiledTemplate.proxyViewClass.View_ModalOverlay_Host0.detectChangesInternal (/ModalModule/ModalOverlay/host.ngfactory.js:32:14)
at CompiledTemplate.proxyViewClass.AppView.detectChanges (http://localhost:3000/vendor.dll.js:79810:14)
at CompiledTemplate.proxyViewClass.DebugAppView.detectChanges (http://localhost:3000/vendor.dll.js:80005:44)
at ViewContainer.detectChangesInNestedViews (http://localhost:3000/vendor.dll.js:80143:37)
at CompiledTemplate.proxyViewClass.View_AppComponent_Host0.detectChangesInternal (/AppModule/AppComponent/host.ngfactory.js:31:14)
at CompiledTemplate.proxyViewClass.AppView.detectChanges (http://localhost:3000/vendor.dll.js:79810:14)
at CompiledTemplate.proxyViewClass.DebugAppView.detectChanges (http://localhost:3000/vendor.dll.js:80005:44)
at ViewRef_.detectChanges (http://localhost:3000/vendor.dll.js:59572:20)
at http://localhost:3000/vendor.dll.js:40308:67
at Array.forEach (native)
at ApplicationRef_.tick (http://localhost:3000/vendor.dll.js:40308:25)
at http://localhost:3000/vendor.dll.js:40227:105
at ZoneDelegate.invoke (http://localhost:3000/polyfills.dll.js:4162:26)
at Object.onInvoke (http://localhost:3000/vendor.dll.js:30260:37)
at ZoneDelegate.invoke (http://localhost:3000/polyfills.dll.js:4161:32)
at Zone.run (http://localhost:3000/polyfills.dll.js:4033:43)
at NgZone.run (http://localhost:3000/vendor.dll.js:30129:62)
at Object.next (http://localhost:3000/vendor.dll.js:40227:81)
at SafeSubscriber.schedulerFn [as _next] (http://localhost:3000/vendor.dll.js:42094:52)
at SafeSubscriber.__tryOrUnsub (http://localhost:3000/vendor.dll.js:591:16)
at SafeSubscriber.next (http://localhost:3000/vendor.dll.js:540:22)
at Subscriber._next (http://localhost:3000/vendor.dll.js:493:26)
at Subscriber.next (http://localhost:3000/vendor.dll.js:457:18)
at EventEmitter.Subject.next (http://localhost:3000/vendor.dll.js:4237:25)
at EventEmitter.emit (http://localhost:3000/vendor.dll.js:42080:76)
at NgZone.checkStable (http://localhost:3000/vendor.dll.js:30225:40)
at NgZone.onLeave (http://localhost:3000/vendor.dll.js:30301:14)
at Object.onInvokeTask (http://localhost:3000/vendor.dll.js:30254:27)
at ZoneDelegate.invokeTask (http://localhost:3000/polyfills.dll.js:4194:40)
at Zone.runTask (http://localhost:3000/polyfills.dll.js:4071:47)
at HTMLButtonElement.ZoneTask.invoke (http://localhost:3000/polyfills.dll.js:4265:33)
Anyone an idea how to get this running? When I move the component to a module which is not async loaded, then all is fine.
As a base I'm using the angular2-webpack-starter.