Information Security with HelmetJS - Set a Content Security Policy with helmet.contentSecurityPolicy()

Tell us what’s happening:
Describe your issue in detail here.

Your code so far

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36

Challenge: Information Security with HelmetJS - Set a Content Security Policy with helmet.contentSecurityPolicy()

Link to the challenge:

@namvhhs153169 welcome to the community!

How can we help? :raised_hands:

why am i getting this error

Error: csp must be called with an object argument. See the documentation.
at module.exports [as default] (/home/runner/helmetlessons/node_modules/helmet/node_modules/helmet-csp/dist/lib/check-options/index.js:12:15)
at Function.csp [as contentSecurityPolicy] (/home/runner/helmetlessons/node_modules/helmet/node_modules/helmet-csp/dist/index.js:16:28)
at Object. (/home/runner/helmetlessons/myApp.js:25:8)
at Module._compile (node:internal/modules/cjs/loader:1159:14)
at Module._extensions…js (node:internal/modules/cjs/loader:1213:10)
at Module.load (node:internal/modules/cjs/loader:1037:32)
at Module._load (node:internal/modules/cjs/loader:878:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:23:47

Node.js v18.12.1

Can you share a link to your code please? That way we can see more easily what might be going wrong.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.