Skip to content

Running sentry:publish a 2nd time w/ JS enabled will cause .env to not parse #927

@benvinegar

Description

@benvinegar

How do you use Sentry?

Sentry SaaS (sentry.io)

SDK version

4.7.1

Laravel version

11.15.0

Steps to reproduce

Run php artisan sentry:publish --dsn=your_dsn once, selecting yes for "Do you want to install one of our JavaScript SDKs? (yes/no)" and choosing a frontend framework (I chose React).

Your .env file will look like this:

SENTRY_LARAVEL_DSN=https://[email protected]/1234567
SENTRY_TRACES_SAMPLE_RATE=1.0
VITE_SENTRY_DSN_PUBLIC="${SENTRY_LARAVEL_DSN}"

Run php artisan sentry:publish --dsn=your_dsn a second time, again selecting yes for JavaScript framework.

Afterwards, try to run any Laravel command (e.g. php artisan serve).

Expected result

It should just work / not cause any exceptions or non-parseable files.

Actual result

The .env file will look like this:

SENTRY_LARAVEL_DSN=https://[email protected]/1234567
SENTRY_TRACES_SAMPLE_RATE=1.0
VITE_SENTRY_DSN_PUBLIC="${SENTRY_LARAVEL_DSN}"
{SENTRY_LARAVEL_DSN}"

Now if you try to run php artisan serve, you will get:

The environment file is invalid!
Failed to parse dotenv file. Encountered an invalid name at [{SENTRY_LARAVEL_DSN}"].

Metadata

Metadata

Assignees

Labels

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions