microsoft / microsoft/azurechat
Error after deployment from VSCode in middleware withtout changes
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.4k
- Forks
- 1.3k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 1
Description
Hi, the following error occurs after deploying to the webapp with SCM = FALSE Parameter (with true the deployment is not possible)
2024-02-28T19:33:40.430126262Z EvalError: Code generation from strings disallowed for this context
2024-02-28T19:33:40.430129962Z at (middleware)/./node_modules/next/dist/build/webpack/loaders/next-middleware-loader.js?absolutePagePath=C%3A%5CAIRepos%5CXXXXXXXXXXX%5Cai-chat-poc%5Csrc%5Cmiddleware.ts&page=%2Fmiddleware&rootDir=C%3A%5CAIRepos%5CXXXXXXXXXXX%5Cai-chat-poc%5Csrc&matchers=&preferredRegion=&middlewareConfig=e30%3D! (/home/site/wwwroot/.next/server/middleware.js:41:1)
2024-02-28T19:33:40.430135062Z at webpack_require (/home/site/wwwroot/.next/server/edge-runtime-webpack.js:37:33)
2024-02-28T19:33:40.430139662Z at webpack_exec (/home/site/wwwroot/.next/server/middleware.js:2203:48)
2024-02-28T19:33:40.430143462Z at /home/site/wwwroot/.next/server/middleware.js:2204:37
2024-02-28T19:33:40.430146962Z at webpackJsonpCallback (/home/site/wwwroot/.next/server/edge-runtime-webpack.js:1128:39)
2024-02-28T19:33:40.430150762Z at /home/site/wwwroot/.next/server/middleware.js:10:61
2024-02-28T19:33:40.430154562Z at Script.runInContext (node:vm:134:12)
2024-02-28T19:33:40.430157963Z at runInContext (node:vm:280:6)
2024-02-28T19:33:40.430161563Z at evaluateInContext (/home/site/wwwroot/node_modules/next/dist/server/web/sandbox/context.js:377:38)
2024-02-28T19:33:40.430165063Z at getRuntimeContext (/home/site/wwwroot/node_modules/next/dist/server/web/sandbox/sandbox.js:70:9)
2024-02-28T19:33:40.474511592Z /home/site/wwwroot/.next/server/middleware.js:41
2024-02-28T19:33:40.474604094Z eval("webpack_require.r(webpack_exports);\n/* harmony export / webpack_require.d(webpack_exports, {\n/ harmony export / "default": () => (/ binding / nHandler)\n/ harmony export / });\n/ harmony import / var next_dist_server_web_globals__WEBPACK_IMPORTED_MODULE_0__ = webpack_require(/! next/dist/server/web/globals / "(middleware)/./node_modules/next/dist/esm/server/web/globals.js");\n/ harmony import / var next_dist_server_web_adapter__WEBPACK_IMPORTED_MODULE_1__ = webpack_require(/! next/dist/server/web/adapter / "(middleware)/./node_modules/next/dist/esm/server/web/adapter.js");\n/ harmony import / var middleware_ts__WEBPACK_IMPORTED_MODULE_2_ = webpack_require(/! ./middleware.ts */ "(middleware)/./middleware.ts");\n\n\n// Import the userland code.\n\nconst mod = {\n ...middleware_ts__WEBPACK_IMPORTED_MODULE_2_\n};\nconst handler = mod.middleware || mod.default;\nconst page = "/middleware";\nif (typeof handler !== "function") {\n throw new Error(The Middleware \"${page}\" must export a \\middleware\or a \\default\function);\n}\nfunction nHandler(opts) {\n return (0,next_dist_server_web_adapter__WEBPACK_IMPORTED_MODULE_1__.adapter)({\n ...opts,\n page,\n handler\n });\n}\n\n//# sourceMappingURL=middleware.js.map//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiKG1pZGRsZXdhcmUpLy4vbm9kZV9tb2R1bGVzL25leHQvZGlzdC9idWlsZC93ZWJwYWNrL2xvYWRlcnMvbmV4dC1taWRkbGV3YXJlLWxvYWRlci5qcz9hYnNvbHV0ZVBhZ2VQYXRoPUMlM0ElNUNBSVJlcG9zJTVDZ3JheW9hay1henVyZWNoYXQtc3RhcnRlci10ZW1wbGF0ZSU1Q2hyLWFpLWNoYXQtcG9jJTVDc3JjJTVDbWlkZGxld2FyZS50cyZwYWdlPSUyRm1pZGRsZXdhcmUmcm9vdERpcj1DJTNBJTVDQUlSZXBvcyU1Q2dyYXlvYWstYXp1cmVjaGF0LXN0YXJ0ZXItdGVtcGxhdGUlNUNoci1haS1jaGF0LXBvYyU1Q3NyYyZtYXRjaGVycz0mcHJlZmVycmV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gICAgICBoYW5kbGVyXG4gICAgfSk7XG59XG5cbi8vIyBzb3VyY2VNYXBwaW5nVVJMPW1pZGRsZXdhcmUuanMubWFwIl0sIm5hbWVzIjpbXSwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///(middleware)/./node_modules/next/dist/build/webpack/loaders/next-middleware-loader.js?absolutePagePath=C%3A%5CAIRepos%5CXXXXXXXXXXX%5Cai-chat-poc%5Csrc%5Cmiddleware.ts&page=%2Fmiddleware&rootDir=C%3A%5CAIRepos%5CXXXXXXXXXXX%5Cai-chat-poc%5Csrc&matchers=&preferredRegion=&middlewareConfig=e30%3D!\n");
2024-02-28T19:33:40.474644795Z ^
2024-02-28T19:33:40.474649395Z
I have changed the startup command like described in other issues from
next start
to
node_modules/nuxt/bin/nuxt.js start
I think the main problem is shown in the error message at this part:
internal:///(middleware)/./node_modules/next/dist/build/webpack/loaders/next-middleware-loader.js?absolutePagePath=C%3A%5CAIRepos%5CXXXXXXXXXXX%5Cai-chat-poc%5Csrc%5Cmiddleware.ts&page=%2Fmiddleware&rootDir=C%3A%5CAIRepos%5CXXXXXXXXXXX%5Cai-chat-
it looks like the Path to MY local PC C:\ ... where the code is for developing.
any ideas?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with src/middleware.ts and the generated .next/server/middleware.js stack trace, then compare the deployment startup command and the SCM=false configuration. Check how the Next middleware loader is produced and run in the deployed web app; done means the middleware starts without the EvalError after deployment.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, next.js, typescript
- Domain
- cloud, devops, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100