Changes are applied only after I save svelte.config.js. (It seems like building through HMR fails.) - build

My problem
Even though I make a change in a file, it's not being reflected on the reseult.
Codes are flickering right after I save a change.
But It's being reflected on the result only after I save svelte.config.js without changing anything in svelte.config.js.
codes are flickering after I made a change
I'm struggling over 3 days. It seems like HMR is not working. More precisely, I guess building is failing when it's done through HMR.
On the first dev start, it works. But When I make changes in a file and save it, it doesn't apply changes. The codes keep flickering after saving my changes without reflecting it as a result of the browser.
But the strange thing is, It reflects changes only after I save svelte.config.js file. Right after I save svelte.config.js, the dev server restarts and the flickering effect of codes stops and changes are reflected. I first thought "maybe is it working only after the server is restarted..?" But it didn't. Changes were not reflected when I savfe vite.config.js. Same flickering effect.
Right now, I have to save svelte.config.js file every time I make some change in any files without knowing the reason. (so painful......and it takes a few seconds everytime I do it)
I recorded my screen
https://www.loom.com/share/71dab382a20547919e07bf410d49fc9d
My package.json
{
"name": "sveltekit-typescript-showcase",
"version": "1.0.0",
"scripts": {
"dev": "vite dev",
"build": "vite build",
"build:types": "openapi-typescript https://vskodzianevmhpqzmjqd.supabase.co/rest/v1/?apikey=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InZza29kemlhbmV2bWhwcXptanFkIiwicm9sZSI6ImFub24iLCJpYXQiOjE2NTI0Mzg0MTAsImV4cCI6MTk2ODAxNDQxMH0.pqf9e6G8pcMxCdVVIipD-RXJrYV-9RJK_qWruTkjGAg --output src/types/supabase.ts",
"gen-type-dev": "supabase gen types typescript --db-url postgres://postgres:HappyHyein66!#db.jgxpeedixksinkdlpfwp.supabase.co:6543/postgres",
"package": "vite package",
"preview": "vite preview"
},
"devDependencies": {
"#supabase/supabase-js": "^1.35.3",
"#types/lodash": "^4.14.186",
"carbon-components-svelte": "^0.65.0",
"openapi-typescript": "5.4.0",
"prettier": "^2.6.2",
"sass": "^1.52.2",
"svelte": "^3.46.6",
"svelte-check": "^2.4.6",
"svelte-preprocess": "^4.10.5",
"tslib": "^2.3.1",
"typescript": "~4.6.3",
"vite": "^3.1.7",
"#sveltejs/kit": "^1.0.0-next.359"
},
"type": "module",
"dependencies": {
"#supabase/supabase-js": "^1.35.3",
"#sveltejs/adapter-vercel": "^1.0.0-next.80",
"#sveltejs/kit": "^1.0.0-next.359",
"base64-arraybuffer": "^1.0.2",
"carbon-icons-svelte": "^11.1.0",
"svelte": "^3.46.6",
"encoding": "^0.1.13",
"lodash": "^4.17.21",
"nvm": "^0.0.4",
"supabase": "^0.5.0"
}
}
svelte.config.js
import vercel from '#sveltejs/adapter-vercel';
import { resolve } from 'path';
import preprocess from 'svelte-preprocess';
const config = {
// Consult https://github.com/sveltejs/svelte-preprocess
// for more information about preprocessors
preprocess: preprocess(),
alias: {
$lib: resolve('./src/lib'),
$models: resolve('./src/models'),
},
kit: {
adapter: vercel()
},
};
export default config;
vite.config.js
import { sveltekit } from '#sveltejs/kit/vite';
import { resolve } from 'path';
const config = {
plugins: [sveltekit()],
resolve: {
alias: {
$lib: resolve( './src/lib'),
$models: resolve('./src/models'),
$types: resolve('./src/types/index.ts')
},
},
server: {
fs: {
// Allow serving files from one level up to the project root
allow: ['..'],
},
},
}
export default config;
I tried adding svelte.config.js options into vite.config.js.
vite.config.js
import { sveltekit } from '#sveltejs/kit/vite';
import { resolve } from 'path';
const config = {
plugins: [sveltekit({
preprocess: preprocess(),
alias: {
$lib: resolve('./src/lib'),
$models: resolve('./src/models'),
},
kit: {
adapter: vercel()
},
})],
resolve: {
alias: {
$lib: resolve( './src/lib'),
$models: resolve('./src/models'),
$types: resolve('./src/types/index.ts')
},
},
server: {
fs: {
// Allow serving files from one level up to the project root
allow: ['..'],
},
},
}
export default config;
npm update after reading it (svelte - Vite+SvelteKit Build Failing - Stack Overflow)
removed alias option in vite.config.js
Deleted node_modules and npm install again. There were suspicious 2 warns... (raw logs are attached below)
6:36:53 PM [vite] changed tsconfig file detected: C:\Users\Jooyeon\Downloads\modeny-svelte-typescript\tsconfig.json - Clearing cache and forcing full-reload to ensure TypeScript is compiled with updated config values.
npm WARN deprecated nvm#0.0.4: This is NOT the correct nvm. Visit https://nvm.sh and use the curl command to install it.
// Raw
6:26:23 PM [vite] server restarted.
➜ Local: http://127.0.0.1:5173/
➜ Network: use --host to expose
The following Vite config options will be overridden by SvelteKit:
- resolve.alias.$lib
6:26:24 PM [vite-plugin-svelte] C:/Users/Jooyeon/Downloads/modeny-svelte-typescript/src/lib/component/Sidebar.svelte:111:0 Unused CSS selector ".menu-icon.home"
6:26:24 PM [vite-plugin-svelte] C:/Users/Jooyeon/Downloads/modeny-svelte-typescript/src/lib/component/Sidebar.svelte:123:0 Unused CSS selector ".menu-icon.hanger"
6:26:26 PM [vite-plugin-svelte] C:/Users/Jooyeon/Downloads/modeny-svelte-typescript/node_modules/carbon-components-svelte/src/ComposedModal/ComposedModal.svelte:153:2 A11y: visible, non-interactive elements with an on:click event must be accompanied by an on:keydown, on:keyup, or on:keypress event.
6:26:26 PM [vite-plugin-svelte] C:/Users/Jooyeon/Downloads/modeny-svelte-typescript/node_modules/carbon-components-svelte/src/ComposedModal/ModalBody.svelte:9:0 A11y: noninteractive element cannot have positive tabIndex value
6:26:26 PM [vite-plugin-svelte] C:/Users/Jooyeon/Downloads/modeny-svelte-typescript/node_modules/carbon-components-svelte/src/CodeSnippet/CodeSnippet.svelte:221:4 A11y: noninteractive element cannot have positive tabIndex value
6:26:27 PM [vite-plugin-svelte] C:/Users/Jooyeon/Downloads/modeny-svelte-typescript/node_modules/carbon-components-svelte/src/DataTable/DataTableSkeleton.svelte:66:2 A11y: visible, non-interactive elements with an on:click event must be accompanied by an on:keydown, on:keyup, or on:keypress event.
6:26:27 PM [vite-plugin-svelte] C:/Users/Jooyeon/Downloads/modeny-svelte-typescript/node_modules/carbon-components-svelte/src/FileUploader/FileUploaderButton.svelte:63:0 A11y: noninteractive element cannot have positive tabIndex value
6:26:27 PM [vite-plugin-svelte] C:/Users/Jooyeon/Downloads/modeny-svelte-typescript/node_modules/carbon-components-svelte/src/FileUploader/FileUploaderDropContainer.svelte:84:2 A11y: noninteractive element cannot have positive tabIndex value
6:26:27 PM [vite-plugin-svelte] C:/Users/Jooyeon/Downloads/modeny-svelte-typescript/node_modules/carbon-components-svelte/src/ListBox/ListBoxField.svelte:46:0 A11y: noninteractive element cannot have positive tabIndex value
6:26:27 PM [vite-plugin-svelte] C:/Users/Jooyeon/Downloads/modeny-svelte-typescript/node_modules/carbon-components-svelte/src/Modal/Modal.svelte:242:4 A11y: noninteractive element cannot have positive tabIndex value
6:26:27 PM [vite-plugin-svelte] C:/Users/Jooyeon/Downloads/modeny-svelte-typescript/node_modules/carbon-components-svelte/src/NumberInput/NumberInput.svelte:156:0 A11y: visible, non-interactive elements with an on:click event must be accompanied by an on:keydown, on:keyup, or on:keypress event.
6:26:28 PM [vite-plugin-svelte] C:/Users/Jooyeon/Downloads/modeny-svelte-typescript/node_modules/carbon-components-svelte/src/Search/Search.svelte:104:4 A11y: visible, non-interactive elements with an on:click event must be accompanied by an on:keydown, on:keyup, or on:keypress event.
6:26:28 PM [vite-plugin-svelte] C:/Users/Jooyeon/Downloads/modeny-svelte-typescript/node_modules/carbon-components-svelte/src/StructuredList/StructuredListRow.svelte:15:2 A11y: noninteractive element cannot have positive tabIndex value
6:26:28 PM [vite-plugin-svelte] C:/Users/Jooyeon/Downloads/modeny-svelte-typescript/node_modules/carbon-components-svelte/src/Tile/SelectableTile.svelte:56:0 A11y: noninteractive element cannot have positive tabIndex value
6:26:28 PM [vite-plugin-svelte] C:/Users/Jooyeon/Downloads/modeny-svelte-typescript/node_modules/carbon-components-svelte/src/TextArea/TextArea.svelte:62:0 A11y: visible, non-interactive elements with an on:click event must be accompanied by an on:keydown, on:keyup, or on:keypress event.
6:26:28 PM [vite-plugin-svelte] C:/Users/Jooyeon/Downloads/modeny-svelte-typescript/node_modules/carbon-components-svelte/src/TimePicker/TimePicker.svelte:55:0 A11y: visible, non-interactive elements with an on:click event must be accompanied by an on:keydown, on:keyup, or on:keypress event.
6:26:28 PM [vite-plugin-svelte] C:/Users/Jooyeon/Downloads/modeny-svelte-typescript/node_modules/carbon-components-svelte/src/TextInput/TextInput.svelte:103:0 A11y: visible, non-interactive elements with an on:click event must be accompanied by an on:keydown, on:keyup, or on:keypress event.
6:26:28 PM [vite-plugin-svelte] C:/Users/Jooyeon/Downloads/modeny-svelte-typescript/node_modules/carbon-components-svelte/src/TextInput/PasswordInput.svelte:97:0 A11y: visible, non-interactive elements with an on:click event must be accompanied by an on:keydown, on:keyup, or on:keypress event.
6:26:28 PM [vite-plugin-svelte] C:/Users/Jooyeon/Downloads/modeny-svelte-typescript/node_modules/carbon-components-svelte/src/Tooltip/Tooltip.svelte:252:6 A11y: visible, non-interactive elements with an on:click event must be accompanied by an on:keydown, on:keyup, or on:keypress event.
6:26:29 PM [vite-plugin-svelte] C:/Users/Jooyeon/Downloads/modeny-svelte-typescript/node_modules/carbon-components-svelte/src/UIShell/SideNav.svelte:52:2 A11y: visible, non-interactive elements with an on:click event must be accompanied by an on:keydown, on:keyup, or on:keypress event.
6:26:29 PM [vite-plugin-svelte] C:/Users/Jooyeon/Downloads/modeny-svelte-typescript/node_modules/carbon-components-svelte/src/UIShell/HeaderSearch.svelte:64:7 A11y: Elements with the ARIA role "combobox" must have the following attributes defined: "aria-controls", "aria-expanded"
6:26:29 PM [vite-plugin-svelte] C:/Users/Jooyeon/Downloads/modeny-svelte-typescript/node_modules/carbon-components-svelte/src/TreeView/TreeViewNodeList.svelte:135:6 A11y: visible, non-interactive elements with an on:click event must be accompanied by an on:keydown, on:keyup, or on:keypress event.
data! {}
data! {}
files in the public directory are served at the root path.
Instead of /static/icon/customer.svg, use /icon/customer.svg.
files in the public directory are served at the root path.
Instead of /static/icon/add.svg, use /icon/add.svg.
files in the public directory are served at the root path.
Instead of /static/icon/schedule.svg, use /icon/schedule.svg.
6:26:34 PM [vite-plugin-svelte] C:/Users/Jooyeon/Downloads/modeny-svelte-typescript/src/lib/component/Sidebar.svelte:111:0 Unused CSS selector ".menu-icon.home"
6:26:34 PM [vite-plugin-svelte] C:/Users/Jooyeon/Downloads/modeny-svelte-typescript/src/lib/component/Sidebar.svelte:123:0 Unused CSS selector ".menu-icon.hanger"
data! {}
6:26:37 PM [vite-plugin-svelte] C:/Users/Jooyeon/Downloads/modeny-svelte-typescript/node_modules/carbon-components-svelte/src/ComposedModal/ComposedModal.svelte:153:2 A11y: visible, non-interactive elements with an on:click event must be accompanied by an on:keydown, on:keyup, or on:keypress event.
6:26:37 PM [vite-plugin-svelte] C:/Users/Jooyeon/Downloads/modeny-svelte-typescript/node_modules/carbon-components-svelte/src/ComposedModal/ModalBody.svelte:9:0 A11y: noninteractive element cannot have positive tabIndex value
6:26:37 PM [vite-plugin-svelte] C:/Users/Jooyeon/Downloads/modeny-svelte-typescript/node_modules/carbon-components-svelte/src/CodeSnippet/CodeSnippet.svelte:221:4 A11y: noninteractive element cannot have positive tabIndex value
6:26:38 PM [vite-plugin-svelte] C:/Users/Jooyeon/Downloads/modeny-svelte-typescript/node_modules/carbon-components-svelte/src/DataTable/DataTableSkeleton.svelte:66:2 A11y: visible, non-interactive elements with an on:click event must be accompanied by an on:keydown, on:keyup, or on:keypress event.
onents-svelte/src/Tooltip/Tooltip.svelte:252:6 A11y: visible, non-interactive elements with an on:click event must be accompanied by an on:keydown, on:keyup, or on:keypress event.
6:26:43 PM [vite-plugin-svelte] C:/Users/Jooyeon/Downloads/modeny-svelte-typescript/node_modules/carbon-components-svelte/src/TimePicker/TimePicker.svelte:55:0 A11y: visible, non-interactive elements with an on:click event must be accompanied by an on:keydown, on:keyup, or on:keypress event.
6:26:43 PM [vite-plugin-svelte] C:/Users/Jooyeon/Downloads/modeny-svelte-typescript/node_modules/carbon-components-svelte/src/UIShell/SideNav.svelte:52:2 A11y: visible, non-interactive elements with an on:click event must be accompanied by an on:keydown, on:keyup, or on:keypress event.
6:26:43 PM [vite-plugin-svelte] C:/Users/Jooyeon/Downloads/modeny-svelte-typescript/node_modules/carbon-components-svelte/src/UIShell/HeaderSearch.svelte:64:7 A11y: Elements with the ARIA role "combobox" must have the following attributes defined: "aria-controls", "aria-expanded"
6:26:44 PM [vite-plugin-svelte] C:/Users/Jooyeon/Downloads/modeny-svelte-typescript/node_modules/carbon-components-svelte/src/TreeView/TreeViewNodeList.svelte:135:6 A11y: visible, non-interactive elements with an on:click event must be accompanied by an on:keydown, on:keyup, or on:keypress event.
6:36:53 PM [vite] changed tsconfig file detected: C:\Users\Jooyeon\Downloads\modeny-svelte-typescript\tsconfig.json - Clearing cache and forcing full-reload to ensure TypeScript is compiled with updated config values.
6:36:54 PM [vite-plugin-svelte] C:/Users/Jooyeon/Downloads/modeny-svelte-typescript/src/lib/component/Sidebar.svelte:111:0 Unused CSS selector ".menu-icon.home"
6:36:54 PM [vite-plugin-svelte] C:/Users/Jooyeon/Downloads/modeny-svelte-typescript/src/lib/component/Sidebar.svelte:123:0 Unused CSS selector ".menu-icon.hanger"
6:36:56 PM [vite-plugin-svelte] C:/Users/Jooyeon/Downloads/modeny-svelte-typescript/node_modules/carbon-components-svelte/src/ComposedModal/ComposedModal.svelte:153:2 A11y: visible, non-interactive elements with an on:click event must be accompanied by an on:keydown, on:keyup, or on:keypress event.
6:36:56 PM [vite-plugin-svelte] C:/Users/Jooyeon/Downloads/modeny-svelte-typescript/node_modules/carbon-components-svelte/src/ComposedModal/ModalBody.svelte:9:0 A11y: noninteractive element cannot have positive tabIndex value
6:36:56 PM [vite-plugin-svelte] C:/Users/Jooyeon/Downloads/modeny-svelte-typescript/node_modules/carbon-components-svelte/src/CodeSnippet/CodeSnippet.svelte:221:4 A11y: noninteractive element cannot have positive tabIndex value
6:36:56 PM [vite-plugin-svelte] C:/Users/Jooyeon/Downloads/modeny-svelte-typescript/node_modules/carbon-components-svelte/src/DataTable/DataTableSkeleton.svelte:66:2 A11y: visible, non-interactive elements with an on:click event must be accompanied by an on:keydown, on:keyup, or on:keypress event.
6:36:56 PM [vite-plugin-svelte] C:/Users/Jooyeon/Downloads/modeny-svelte-typescript/node_modules/carbon-components-svelte/src/FileUploader/FileUploaderButton.svelte:63:0 A11y: noninteractive element cannot have positive tabIndex value
6:36:56 PM [vite-plugin-svelte] C:/Users/Jooyeon/Downloads/modeny-svelte-typescript/node_modules/carbon-components-svelte/src/FileUploader/FileUploaderDropContainer.svelte:84:2 A11y: noninteractive element cannot have positive tabIndex value
6:36:57 PM [vite-plugin-svelte] C:/Users/Jooyeon/Downloads/modeny-svelte-typescript/node_modules/carbon-components-svelte/src/ListBox/ListBoxField.svelte:46:0 A11y: noninteractive element cannot have positive tabIndex value
6:36:57 PM [vite-plugin-svelte] C:/Users/Jooyeon/Downloads/modeny-svelte-typescript/node_modules/carbon-components-svelte/src/Modal/Modal.svelte:242:4 A11y: noninteractive element cannot have positive tabIndex value
6:36:57 PM [vite-plugin-svelte] C:/Users/Jooyeon/Downloads/modeny-svelte-typescript/node_modules/carbon-components-svelte/src/NumberInput/NumberInput.svelte:156:0 A11y: visible, non-interactive elements with an on:click event must be accompanied by an on:keydown, on:keyup, or on:keypress event.
6:36:57 PM [vite-plugin-svelte] C:/Users/Jooyeon/Downloads/modeny-svelte-typescript/node_modules/carbon-components-svelte/src/Search/Search.svelte:104:4 A11y: visible, non-interactive elements with an on:click event must be accompanied by an on:keydown, on:keyup, or on:keypress event.
6:36:58 PM [vite-plugin-svelte] C:/Users/Jooyeon/Downloads/modeny-svelte-typescript/node_modules/carbon-components-svelte/src/StructuredList/StructuredListRow.svelte:15:2 A11y: noninteractive element cannot have positive tabIndex value
6:36:58 PM [vite-plugin-svelte] C:/Users/Jooyeon/Downloads/modeny-svelte-typescript/node_modules/carbon-components-svelte/src/TextInput/TextInput.svelte:103:0 A11y: visible, non-interactive elements with an on:click event must be accompanied by an on:keydown, on:keyup, or on:keypress event.
6:36:58 PM [vite-plugin-svelte] C:/Users/Jooyeon/Downloads/modeny-svelte-typescript/node_modules/carbon-components-svelte/src/TextInput/PasswordInput.svelte:97:0 A11y: visible, non-interactive elements with an on:click event must be accompanied by an on:keydown, on:keyup, or on:keypress event.
6:36:58 PM [vite-plugin-svelte] C:/Users/Jooyeon/Downloads/modeny-svelte-typescript/node_modules/carbon-components-svelte/src/Tile/SelectableTile.svelte:56:0 A11y: noninteractive element cannot have positive tabIndex value
6:36:58 PM [vite-plugin-svelte] C:/Users/Jooyeon/Downloads/modeny-svelte-typescript/node_modules/carbon-components-svelte/src/TimePicker/TimePicker.svelte:55:0 A11y: visible, non-interactive elements with an on:click event must be accompanied by an on:keydown, on:keyup, or on:keypress event.
6:36:58 PM [vite-plugin-svelte] C:/Users/Jooyeon/Downloads/modeny-svelte-typescript/node_modules/carbon-components-svelte/src/TextArea/TextArea.svelte:62:0 A11y: visible, non-interactive elements with an on:click event must be accompanied by an on:keydown, on:keyup, or on:keypress event.
6:36:58 PM [vite-plugin-svelte] C:/Users/Jooyeon/Downloads/modeny-svelte-typescript/node_modules/carbon-components-svelte/src/Tooltip/Tooltip.svelte:252:6 A11y: visible, non-interactive elements with an on:click event must be accompanied by an on:keydown, on:keyup, or on:keypress event.
6:36:58 PM [vite-plugin-svelte] C:/Users/Jooyeon/Downloads/modeny-svelte-typescript/node_modules/carbon-components-svelte/src/UIShell/SideNav.svelte:52:2 A11y: visible, non-interactive elements with an on:click event must be accompanied by an on:keydown, on:keyup, or on:keypress event.
6:36:59 PM [vite-plugin-svelte] C:/Users/Jooyeon/Downloads/modeny-svelte-typescript/node_modules/carbon-components-svelte/src/UIShell/HeaderSearch.svelte:64:7 A11y: Elements with the ARIA role "combobox" must have the following attributes defined: "aria-controls", "aria-expanded"
6:36:59 PM [vite-plugin-svelte] C:/Users/Jooyeon/Downloads/modeny-svelte-typescript/node_modules/carbon-components-svelte/src/TreeView/TreeViewNodeList.svelte:135:6 A11y: visible, non-interactive elements with an on:click event must be accompanied by an on:keydown, on:keyup, or on:keypress event.
data! {}
files in the public directory are served at the root path.
Instead of /static/icon/customer.svg, use /icon/customer.svg.
files in the public directory are served at the root path.
Instead of /static/icon/add.svg, use /icon/add.svg.
files in the public directory are served at the root path.
Instead of /static/icon/schedule.svg, use /icon/schedule.svg.
6:37:01 PM [vite-plugin-svelte] C:/Users/Jooyeon/Downloads/modeny-svelte-typescript/src/lib/component/Sidebar.svelte:111:0 Unused CSS selector ".menu-icon.home"
6:37:01 PM [vite-plugin-svelte] C:/Users/Jooyeon/Downloads/modeny-svelte-typescript/src/lib/component/Sidebar.svelte:123:0 Unused CSS selector ".menu-icon.hanger"
data! {}
6:37:04 PM [vite-plugin-svelte] C:/Users/Jooyeon/Downloads/modeny-svelte-typescript/node_modules/carbon-components-svelte/src/ComposedModal/ComposedModal.svelte:153:2 A11y: visible, non-interactive elements with an on:click event must be accompanied by an on:keydown, on:keyup, or on:keypress event.
6:37:04 PM [vite-plugin-svelte] C:/Users/Jooyeon/Downloads/modeny-svelte-typescript/node_modules/carbon-components-svelte/src/ComposedModal/ModalBody.svelte:9:0 A11y: noninteractive element cannot have positive tabIndex value
6:37:04 PM [vite-plugin-svelte] C:/Users/Jooyeon/Downloads/modeny-svelte-typescript/node_modules/carbon-components-svelte/src/CodeSnippet/CodeSnippet.svelte:221:4 A11y: noninteractive element cannot have positive tabIndex value
npm WARN deprecated nvm#0.0.4: This is NOT the correct nvm. Visit https://nvm.sh and use the curl command to install it.
added 294 packages, and audited 295 packages in 16s
24 packages are looking for funding
run `npm fund` for details
4 vulnerabilities (1 moderate, 3 critical)
To address all issues (including breaking changes), run:
npm audit fix --force
Run `npm audit` for details.

Looking through the simplest package.json file in here(https://stackblitz.com/edit/sveltejs-kit-template-default-wab2ls?file=package.json&terminal=dev) which is in svelte-kit front page(https://kit.svelte.dev/), I found out that there's #types/cookie on the list and not on mine.
I remembered VScode once showed an error message regarding it, So I added it on the list and installed again and it worked...

Related

How do we process the kinesis stream data every one hour?

I have a kinesis stream which is being continuously written with putRecord. In the consumer I consume using processRecords of KCL. This process records gets called whenever there is a record in the stream.I need this process records to be excuted every X hour.
Here are the things that I tried.
kinesisClientLibConfiguration = new KinesisClientLibConfiguration(applicationName, kinesisStreamName,
credsProvider, workerId).withInitialPositionInStream(initialPositionInStream)
.withCallProcessRecordsEvenForEmptyRecordList(true)
.withIdleTimeBetweenReadsInMillis(3600000) //1 hr in millis
.withKinesisEndpoint(kinesisEndpoint);
This does'nt seem to be working. It throws the below exception
[INFO] 2018-02-08T18:41:24.124 com.amazonaws.services.kinesis.clientlibrary.lib.worker.ProcessTask getRecordsResult ShardId shardId-000000000003: getRecords threw ExpiredIteratorException - restarting after greatest seqNum passed to customer
com.amazonaws.services.kinesis.model.ExpiredIteratorException: Iterator expired. The iterator was created at time Thu Feb 08 13:06:04 UTC 2018 while right now it is Thu Feb 08 13:11:23 UTC 2018 which is further in the future than the tolerated delay of 300000 milliseconds. (Service: AmazonKinesis; Status Code: 400; Error Code: ExpiredIteratorException; Request ID: d72ba81b-9a14-cf1d-85dd-e6a01179f91c)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.handleErrorResponse(AmazonHttpClient.java:1639)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeOneRequest(AmazonHttpClient.java:1304)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeHelper(AmazonHttpClient.java:1056)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.doExecute(AmazonHttpClient.java:743)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeWithTimer(AmazonHttpClient.java:717)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.execute(AmazonHttpClient.java:699)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.access$500(AmazonHttpClient.java:667)
at com.amazonaws.http.AmazonHttpClient$RequestExecutionBuilderImpl.execute(AmazonHttpClient.java:649)
at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:513)
at com.amazonaws.services.kinesis.AmazonKinesisClient.doInvoke(AmazonKinesisClient.java:2276)
at com.amazonaws.services.kinesis.AmazonKinesisClient.invoke(AmazonKinesisClient.java:2252)
at com.amazonaws.services.kinesis.AmazonKinesisClient.executeGetRecords(AmazonKinesisClient.java:1062)
at com.amazonaws.services.kinesis.AmazonKinesisClient.getRecords(AmazonKinesisClient.java:1038)
at com.amazonaws.services.kinesis.clientlibrary.proxies.KinesisProxy.get(KinesisProxy.java:158)
at com.amazonaws.services.kinesis.clientlibrary.proxies.MetricsCollectingKinesisProxyDecorator.get(MetricsCollectingKinesisProxyDecorator.java:74)
at com.amazonaws.services.kinesis.clientlibrary.lib.worker.KinesisDataFetcher.getRecords(KinesisDataFetcher.java:74)
at com.amazonaws.services.kinesis.clientlibrary.lib.worker.SynchronousGetRecordsRetrievalStrategy.getRecords(SynchronousGetRecordsRetrievalStrategy.java:31)
at com.amazonaws.services.kinesis.clientlibrary.lib.worker.BlockingGetRecordsCache.getNextResult(BlockingGetRecordsCache.java:50)
at com.amazonaws.services.kinesis.clientlibrary.lib.worker.ProcessTask.getRecordsResultAndRecordMillisBehindLatest(ProcessTask.java:377)
at com.amazonaws.services.kinesis.clientlibrary.lib.worker.ProcessTask.getRecordsResult(ProcessTask.java:342)
at com.amazonaws.services.kinesis.clientlibrary.lib.worker.ProcessTask.call(ProcessTask.java:159)
at com.amazonaws.services.kinesis.clientlibrary.lib.worker.MetricsCollectingTaskDecorator.call(MetricsCollectingTaskDecorator.java:49)
at com.amazonaws.services.kinesis.clientlibrary.lib.worker.MetricsCollectingTaskDecorator.call(MetricsCollectingTaskDecorator.java:24)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Can someone please let me know if there is a work around for achieving this?
Thanks

How to store spark pair rdd as file into HDFS ?

Hi, I created a kafka topic with 3 partitions and 2 replicas. I try to publish messages/records from kafka to spark streaming (for some process), then store data into HDFS. I tried to store pair RDD as text file, but is not working.
this code is not working,
JavaPairInputDStream<String, String> directKafkaStream = KafkaUtils
.createDirectStream(ssc, String.class, String.class,
StringDecoder.class, StringDecoder.class, kafkaParams,
topics);
directKafkaStream.foreachRDD(rdd -> {
if(!rdd.isEmpty()){
rdd.saveAsTextFile(path);
}
}
);
console output:
17/01/09 17:25:39 INFO KafkaRDD: Computing topic filebeat, partition 1 offsets 20 -> 32
17/01/09 17:25:39 INFO VerifiableProperties: Verifying properties
17/01/09 17:25:39 INFO VerifiableProperties: Property group.id is overridden to
17/01/09 17:25:39 INFO VerifiableProperties: Property zookeeper.connect is overridden to localhost:2181
17/01/09 17:25:39 INFO KafkaRDD: Computing topic filebeat, partition 0 offsets 22 -> 34
17/01/09 17:25:39 INFO VerifiableProperties: Verifying properties
17/01/09 17:25:39 INFO VerifiableProperties: Property group.id is overridden to
17/01/09 17:25:39 INFO VerifiableProperties: Property zookeeper.connect is overridden to localhost:2181
17/01/09 17:25:40 INFO JobScheduler: Added jobs for time 1483979140000 ms
17/01/09 17:25:40 ERROR Utils: Aborting task
java.lang.NoClassDefFoundError: org/apache/kafka/common/message/KafkaLZ4BlockOutputStream
at kafka.message.ByteBufferMessageSet$.decompress(ByteBufferMessageSet.scala:65)
at kafka.message.ByteBufferMessageSet$$anon$1.makeNextOuter(ByteBufferMessageSet.scala:179)
at kafka.message.ByteBufferMessageSet$$anon$1.makeNext(ByteBufferMessageSet.scala:192)
at kafka.message.ByteBufferMessageSet$$anon$1.makeNext(ByteBufferMessageSet.scala:146)
at kafka.utils.IteratorTemplate.maybeComputeNext(IteratorTemplate.scala:66)
at kafka.utils.IteratorTemplate.hasNext(IteratorTemplate.scala:58)
at scala.collection.Iterator$$anon$18.hasNext(Iterator.scala:764)
at org.apache.spark.streaming.kafka.KafkaRDD$KafkaRDDIterator.getNext(KafkaRDD.scala:211)
at org.apache.spark.util.NextIterator.hasNext(NextIterator.scala:73)
at scala.collection.Iterator$$anon$11.hasNext(Iterator.scala:408)
at org.apache.spark.rdd.PairRDDFunctions$$anonfun$saveAsHadoopDataset$1$$anonfun$13$$anonfun$apply$7.apply$mcV$sp(PairRDDFunctions.scala:1203)
at org.apache.spark.rdd.PairRDDFunctions$$anonfun$saveAsHadoopDataset$1$$anonfun$13$$anonfun$apply$7.apply(PairRDDFunctions.scala:1203)
at org.apache.spark.rdd.PairRDDFunctions$$anonfun$saveAsHadoopDataset$1$$anonfun$13$$anonfun$apply$7.apply(PairRDDFunctions.scala:1203)
at org.apache.spark.util.Utils$.tryWithSafeFinallyAndFailureCallbacks(Utils.scala:1325)
at org.apache.spark.rdd.PairRDDFunctions$$anonfun$saveAsHadoopDataset$1$$anonfun$13.apply(PairRDDFunctions.scala:1211)
at org.apache.spark.rdd.PairRDDFunctions$$anonfun$saveAsHadoopDataset$1$$anonfun$13.apply(PairRDDFunctions.scala:1190)
at org.apache.spark.scheduler.ResultTask.runTask(ResultTask.scala:70)
at org.apache.spark.scheduler.Task.run(Task.scala:85)
at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:274)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: org.apache.kafka.common.message.KafkaLZ4BlockOutputStream
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 22 more
17/01/09 17:25:40 ERROR Utils: Aborting task
In fact my pom.xml
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-streaming-kafka-0-8_2.11</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-clients</artifactId>
<version>0.9.0.0</version>
</dependency>

Can't get jetty to read jetty-env.xml

I have the following:
Startup code:
Server server = new Server(8080);
WebAppContext context = new WebAppContext();
context.setDescriptor("/WEB-INF/web.xml");
context.setResourceBase("/home/webapp);
context.setContextPath("/");
context.setParentLoaderPriority(true);
server.setHandler(context);
server.start();
jetty-env.xml in /home/webapp/WEB-INF:
<?xml version="1.0"?>
<Configure class="org.mortbay.jetty.webapp.WebAppContext">
<New id="properties" class="org.mortbay.jetty.plus.naming.EnvEntry">
<Arg>property_file</Arg>
<Arg>/home/webapp/web.properties</Arg>
</New>
</Configure>
jndi.properties in classpath:
java.naming.factory.url.pkgs=org.eclipse.jetty.jndi
java.naming.factory.initial=org.eclipse.jetty.jndi.InitialContextFactory
The initial context is created OK, but attempting to lookup the property_file key throws name not found exception. Enumeration only returns the keys defined in jndi.properties.
Context initContext = new InitialContext();
Hashtable<?,?> ht = initContext.getEnvironment();
Enumeration<?> keys = ht.keys();
while(keys.hasMoreElements()) {
Object key = keys.nextElement();
System.out.println(key.toString() + "=" + ht.get(key).toString());
}
String props=(String)initContext.lookup("java:comp/env/property_file");
What am I doing wrong?
You have a bad mix of jetty versions.
<Configure class="org.mortbay.jetty.webapp.WebAppContext">
<New id="properties" class="org.mortbay.jetty.plus.naming.EnvEntry">
That points to Jetty 6 use, and ...
java.naming.factory.url.pkgs=org.eclipse.jetty.jndi
java.naming.factory.initial=org.eclipse.jetty.jndi.InitialContextFactory
points to Jetty 9 use...
This is what is messing you up.
The XML you are using will not work on Jetty 9 (Only Jetty 6), and the properties file you are defining should never be defined manually for Jetty 9 (its present in the jetty-jndi-{ver}.jar)
$ jar -tvf lib/jetty-jndi-9.2.9.v20150224.jar | grep jndi.properties
125 Tue Feb 24 10:49:42 MST 2015 jndi.properties
The instructions for Jetty 9 are found at
https://www.eclipse.org/jetty/documentation/current/jndi-embedded.html
This is how you setup Embedded Jetty with JNDI support.
There's some parts you need to enable in the WebAppContext configuration, and that should enable the jetty-env.xml to be used.
Namely ...
// Enable parsing of jndi-related parts of web.xml and jetty-env.xml
Configuration.ClassList classlist = Configuration.ClassList.setServerDefault(server);
classlist.addAfter("org.eclipse.jetty.webapp.FragmentConfiguration",
"org.eclipse.jetty.plus.webapp.EnvConfiguration",
"org.eclipse.jetty.plus.webapp.PlusConfiguration");
Finally, the jetty-env.xml structure and syntax are documented here
https://www.eclipse.org/jetty/documentation/current/jndi-configuration.html
So your example would look like this ...
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN"
"http://www.eclipse.org/jetty/configure_9_0.dtd">
<Configure id="wac" class="org.eclipse.jetty.webapp.WebAppContext">
<New id="properties" class="org.eclipse.jetty.plus.jndi.EnvEntry">
<Arg><Ref refid="wac"/></Arg>
<Arg>property_file</Arg>
<Arg>/home/webapp/web.properties</Arg>
<Arg type="boolean">true</Arg>
</New>
</Configure>
Yes, the DOCTYPE is important.
As for the 4 parameters on EnvEntry, those are documented at the APIDOC site for EnvEntry.
One last piece of advice, DO NOT USE jetty-all.jar for your project, it exists only to allow some basic command line experimentation with Jetty, it is not meant to be used as a dependency in your project.
My apologies, I'm new to jetty and I forgot to mention that I was using embedded mode.
By now I've figured out that in the embedded mode jetty does NOT automatically read jetty-env.xml. You have to do it explicitly, for example:
Resource jettyEnv = Resource.newSystemResource("jetty-env.xml");
XmlConfiguration conf = new XmlConfiguration(jettyEnv.getInputStream());
Object obj = conf.configure();
WebAppContext context = (WebAppContext)obj;
The response about mixing different jetty versions does still apply.

How to disable Sitecore Analytics entirely

We are experiencing cpu problems on our production servers. After profiling with the jetbrains cpu profiler, we have noticed that some functions in the assembly Sitecore.Analytics were executed.
This is somewhat strange because we have disabled all analytics related configuration in de config files.
After looking into the /sitecore/admin/showconfig.aspx we noticed that there are still a lot of Sitecore.Analytics related configurations in this config while these are deactivated in our config files.
For example
In the file /App_Config/Include/EventHandlers.config the configuration looks like this:
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<events timingLevel="custom">
</events>
</sitecore>
</configuration>
When looking into the showconfig.aspx it looks something like this:
<events timingLevel="custom">
<event name="forms:save"/>
<event name="item:saved">
<handler type="Sitecore.Analytics.Data.Items.ItemEventHandler, Sitecore.Analytics" method="OnItemSaved"/>
<handler type="Sitecore.Analytics.Automation.Data.Items.ItemEventHandler, Sitecore.Automation.MarketingAutomation" method="OnAutomationStateChanged"/>
</event>
<event name="item:deleted">
<handler type="Sitecore.Analytics.Automation.Data.Items.ItemEventHandler, Sitecore.Automation.MarketingAutomation" method="OnAutomationStateChanged"/>
</event>
<event name="media:request">
<handler type="Sitecore.Analytics.Media.MediaRequestEventHandler, Sitecore.Analytics" method="OnMediaRequest"/>
</event>
</events>
Does anyone has an idea why these are still returning in the showconfig.aspx?
Is there a way to fully delete/disable the sitecore analytics module?
Yes. Rename the 3 configuration files for Sitecore.Analytics in your /App_Config/Include directory to something other than *.config
The 3 files are:
Sitecore.Analytics.config
Sitecore.Analytics.ExcludeRobots.config
Sitecore.Analytics.RobotDetection.config
(could vary a little bit by version, but they all start with Sitecore.Analytics).
Rename them to something like:
Sitecore.Analytics.config.disabled
Sitecore.Analytics.ExcludeRobots.config.disabled
Sitecore.Analytics.RobotDetection.config.disabled
(could vary a little bit by version, but they all start with Sitecore.Analytics).
Until sitecore version 72, there are only 3 files with Sitecore.Analytics prefix. In version 75, there are 17 and in version 8 there are 20 config files with Sitecore.Analytics prefix.
I used to confirm with sitecore support that you can change the setting of Analytics.Enabled in Sitecore.Analytics.config will disable Analytics
<setting name="Analytics.Enabled" value="false" />
Or only rename one file Sitecore.Analytics.config which contain this setting.
Did you try to User WFFM ?
There also analytics part:
Sitecore.WFFM.Analytics.config
and disabling it causes this fault:
22992 14:49:10 WARN Value cannot be null. Parameter name: owner
Exception: System.ArgumentNullException Message: Value cannot be null.
Parameter name: owner Source: Sitecore.Kernel at
Sitecore.Diagnostics.Assert.ArgumentNotNull(Object argument, String
argumentName) at Sitecore.Diagnostics.Log.Warn(String message,
Object owner) at Sitecore.WFFM.Core.Extensions.Warn.IsNull(Object
obj, String name) at
Sitecore.WFFM.Analytics.AnalyticsTracker.get_SessionId() at
Sitecore.Form.Core.FormDataHandler.ExecuteSaveActions(ID formId,
ControlResult[] fields, ActionDefinition[] actions) at
Sitecore.Form.Core.FormDataHandler.ProcessData(SimpleForm form,
ControlResult[] fields, ActionDefinition[] actions)
So it cannot be disabled.

call application libjingle, user automatically removed from roster. why?

Okay, Tried running the compiled "call" program in libjingle-0.6.14, on 2 laptops with ubuntu 11.10,
When i log in from the first laptop, and logged in again (with different account) from the other lappy.. The user coming online is immediately removed from roster and im left with no one to call...
Here is the Output..
<stream:stream from="gmail.com" id="1D65B8B570251398" version="1.0"xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client">
XmppLoginTask::Advance - LOGINSTATE_STREAMSTART_SENT
RECV <<<<<<<<<<<<<<<< : Tue Aug 21 18:37:51 2012
<stream:features>
<mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
<mechanism>
PLAIN
</mechanism>
<mechanism>
X-GOOGLE-TOKEN
</mechanism>
<mechanism>
X-OAUTH2
</mechanism>
</mechanisms>
</stream:features>
XmppLoginTask::Advance - LOGINSTATE_STARTED_XMPP
XmppLoginTask::Advance - LOGINSTATE_AUTH_INIT
XmppLoginTask::Advance - LOGINSTATE_SASL_RUNNING
SEND >>>>>>>>>>>>>>>> : Tue Aug 21 18:37:51 2012
<auth xmlns="urn:ietf:params:xml:ns:xmpp-sasl" mechanism="PLAIN" auth:allow-
non-google-
login="true" auth:client-uses-full-bind-result="true"
xmlns:auth="http://www.google.com/talk/protocol/auth">
## TEXT REMOVED ##
</auth>
RECV <<<<<<<<<<<<<<<< : Tue Aug 21 18:37:51 2012
<success xmlns="urn:ietf:params:xml:ns:xmpp-sasl"/>
XmppLoginTask::Advance - LOGINSTATE_SASL_RUNNING
XmppLoginTask::Advance - No error
XmppLoginTask::Advance - LOGINSTATE_STREAMSTART_SENT
SEND >>>>>>>>>>>>>>>> : Tue Aug 21 18:37:51 2012
<stream:stream to="gmail.com" xml:lang="*" version="1.0"
xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client">
RECV <<<<<<<<<<<<<<<< : Tue Aug 21 18:37:51 2012
<stream:stream from="gmail.com" id="2B727FCA62E71E0F" version="1.0"
xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client">
XmppLoginTask::Advance - LOGINSTATE_STREAMSTART_SENT
RECV <<<<<<<<<<<<<<<< : Tue Aug 21 18:37:51 2012
<stream:features>
<bind xmlns="urn:ietf:params:xml:ns:xmpp-bind"/>
<session xmlns="urn:ietf:params:xml:ns:xmpp-session"/>
</stream:features>
XmppLoginTask::Advance - LOGINSTATE_STARTED_XMPP
XmppLoginTask::Advance - LOGINSTATE_BIND_INIT
XmppLoginTask::Advance - LOGINSTATE_BIND_REQUESTED
SEND >>>>>>>>>>>>>>>> : Tue Aug 21 18:37:51 2012
<iq type="set" id="0">
<bind xmlns="urn:ietf:params:xml:ns:xmpp-bind">
<resource>
call
</resource>
</bind>
</iq>
RECV <<<<<<<<<<<<<<<< : Tue Aug 21 18:37:51 2012
<iq id="0" type="result">
<bind xmlns="urn:ietf:params:xml:ns:xmpp-bind">
<jid>
tejeshsmith#gmail.com/call6183138F
</jid>
</bind>
</iq>
XmppLoginTask::Advance - LOGINSTATE_BIND_REQUESTED
XmppLoginTask::Advance - LOGINSTATE_SESSION_REQUESTED
SEND >>>>>>>>>>>>>>>> : Tue Aug 21 18:37:51 2012
<iq type="set" id="1">
<session xmlns="urn:ietf:params:xml:ns:xmpp-session"/>
</iq>
RECV <<<<<<<<<<<<<<<< : Tue Aug 21 18:37:51 2012
RECV <<<<<<<<<<<<<<<< : Tue Aug 21 18:37:51 2012
<iq type="result" id="1"/>
XmppLoginTask::Advance - LOGINSTATE_SESSION_REQUESTED
logged in...
Creating default VideoCapturer
Enumerating V4L2 devices
V4L2 device metadata found at /sys/class/video4linux/
Found V4L2 capture device /dev/video0
Trying /sys/class/video4linux/video0/name
Name for video0 is HP Webcam
Total V4L2 devices found : 1
Creating default VideoCapturer
Enumerating V4L2 devices
V4L2 device metadata found at /sys/class/video4linux/
Found V4L2 capture device /dev/video0
Trying /sys/class/video4linux/video0/name
Name for video0 is HP Webcam
Total V4L2 devices found : 1
Selected PulseAudio sound system
Number of references: 1
<pre><code>Number of references: 0
Selected PulseAudio sound system
Number of references: 1
Number of references: 0
Enumerating V4L2 devices
V4L2 device metadata found at /sys/class/video4linux/
Found V4L2 capture device /dev/video0
Trying /sys/class/video4linux/video0/name
Name for video0 is HP Webcam
Total V4L2 devices found : 1
SEND >>>>>>>>>>>>>>>> : Tue Aug 21 18:37:51 2012
<presence>
<status/>
<priority>
0
</priority>
<c xmlns="http://jabber.org/protocol/caps" node="http://code.google.com/p/libjingle
/call" ver="0.6" ext=" pmuc-v1"/>
<x xmlns="jabber:x:delay" stamp="20120821T13:07:51"/>
</presence>
RECV <<<<<<<<<<<<<<<< : Tue Aug 21 18:37:52 2012
<presence from="smithtejesh#gmail.com/callAB04C4D8"
to="tejeshsmith#gmail.com/call6183138F">
<status/>
<priority>
0
</priority>
<c node="http://code.google.com/p/libjingle/call" ver="0.6" ext=" pmuc-v1"
xmlns="http://jabber.org/protocol/caps"/>
<x stamp="20120821T12:58:59" xmlns="jabber:x:delay"/>
<x xmlns="vcard-temp:x:update"/>
Removing from roster: smithtejesh#gmail.com/callAB04C4D8
smithtejesh#gmail.com is REMOVED from roster..automatically... what could be wrong here?
It is likely that the arguments for calling the "call" example are incomplete. The example, without modification, that ships with the libjingle source does not capture video/audio from the computer's hardware. It will play rtp dump files that contain audio/video. The source files do come with sample rtp dump files that can be used to play audio/video to a browser client, or can be "transfered" to another "call" example client and saved locally to a rtcp dump file on the second client.
The proper way to use the call example program is along the lines of (if on linux):
./call --videoinput ./test.rtpdump --voiceinput ./voice.rtpdump --videooutput ./vidoutput.rtpdump --voiceoutput ./voioutput.rtpdump
There are a few issues on the libjingle Google code website that talk about this, I am struggling to find them at the moment. If I do, I will edit this post or add a comment with the links.