File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ yarn-error.log*
1111pnpm-debug.log *
1212.vercel
1313.env * .local
14+ .env.production
1415
1516# Test coverage
1617coverage /
Original file line number Diff line number Diff line change @@ -6,6 +6,31 @@ const withNextIntl = createNextIntlPlugin();
66
77const nextConfig : NextConfig = {
88 transpilePackages : [ '@studytodo/shared' ] ,
9+ async headers ( ) {
10+ return [
11+ {
12+ source : '/(.*)' ,
13+ headers : [
14+ {
15+ key : 'Content-Security-Policy' ,
16+ value : [
17+ "default-src 'self'" ,
18+ "script-src 'self' 'unsafe-inline' 'unsafe-eval' https://pagead2.googlesyndication.com https://www.googletagmanager.com" ,
19+ "style-src 'self' 'unsafe-inline'" ,
20+ "img-src 'self' data: https:" ,
21+ "font-src 'self'" ,
22+ "connect-src 'self' https://*.supabase.co wss://*.supabase.co" ,
23+ "frame-src https://pagead2.googlesyndication.com" ,
24+ "frame-ancestors 'none'" ,
25+ ] . join ( '; ' ) ,
26+ } ,
27+ { key : 'X-Frame-Options' , value : 'DENY' } ,
28+ { key : 'X-Content-Type-Options' , value : 'nosniff' } ,
29+ { key : 'Referrer-Policy' , value : 'strict-origin-when-cross-origin' } ,
30+ ] ,
31+ } ,
32+ ] ;
33+ } ,
934} ;
1035
1136export default withNextIntl ( nextConfig ) ;
Original file line number Diff line number Diff line change @@ -3,18 +3,12 @@ import { createClient } from '@supabase/supabase-js';
33const supabaseUrl = process . env . NEXT_PUBLIC_SUPABASE_URL ;
44const supabaseAnonKey = process . env . NEXT_PUBLIC_SUPABASE_ANON_KEY ;
55
6- // 環境変数がロードされていない場合のエラーハンドリング
76if ( ! supabaseUrl || ! supabaseAnonKey ) {
8- console . error ( `
9- [Supabase Error] Environment variables missing.
10- NEXT_PUBLIC_SUPABASE_URL: ${ supabaseUrl ? "Loaded" : "Missing" }
11- NEXT_PUBLIC_SUPABASE_ANON_KEY: ${ supabaseAnonKey ? "Loaded" : "Missing" }
12- Please check .env.local content format.
13- ` ) ;
7+ throw new Error (
8+ `Supabase environment variables missing. ` +
9+ `NEXT_PUBLIC_SUPABASE_URL: ${ supabaseUrl ? "OK" : "Missing" } , ` +
10+ `NEXT_PUBLIC_SUPABASE_ANON_KEY: ${ supabaseAnonKey ? "OK" : "Missing" } `
11+ ) ;
1412}
1513
16- // クライアント作成(URLがない場合は空文字を渡すが、これを使用するとエラーになるため、使用側でチェックが必要)
17- export const supabase = createClient (
18- supabaseUrl || "https://placeholder.supabase.co" ,
19- supabaseAnonKey || "placeholder-key"
20- ) ;
14+ export const supabase = createClient ( supabaseUrl , supabaseAnonKey ) ;
You can’t perform that action at this time.
0 commit comments