Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

500 Internal Server Error due to dash in cookie consent route prefix #64

Open
captainscorch opened this issue Oct 12, 2024 · 1 comment

Comments

@captainscorch
Copy link

captainscorch commented Oct 12, 2024

Issue Description

The default configuration for the cookie consent url/route prefix includes a dash character, which causes a 500 Internal Server Error when trying to load the cookie consent script, which then causes the buttons to not work anymore, making the consent banner unusable.

Current Behavior

When attempting to load the cookie consent script, the following error occurs:

GET http://localhost:8008/cookie-consent/script?id=XXXXXX net::ERR_ABORTED 500 (Internal Server Error)

When attempting to click on the buttons, the following error occurs:

Uncaught TypeError: Cannot read properties of undefined (reading 'acceptEssentials')

Expected Behavior

The cookie consent script should load without any errors and the buttons should not throw an error and close the consent banner after the action.

Steps to Reproduce

  1. Install the package with default configuration
  2. Attempt to load a page that includes the cookie consent script

Proposed Fix

Change the default prefix in config/cookieconsent.php from:

'prefix' => 'cookie-consent',

to:

'prefix' => 'cookieconsent',

Additional Context

This issue affects the default configuration. Users who have published and modified their configuration may not experience this problem if they've already changed the prefix.

Environment

  • Laravel Version: 11
  • PHP Version: 8.3
  • Package Version: ^1.2
@toonvandenbos
Copy link
Member

Dashes should not cause any problems in slugs. I think you have something else going on. Did you have a look at the details of the error?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants